Issue #1879396 by babruix, jibran, xjm, juanolalla: Add inline docs to block classes

8.0.x
Jennifer Hodgdon 2013-10-15 10:19:05 -07:00
parent 19aeaa740b
commit a7d2952106
2 changed files with 5 additions and 4 deletions

View File

@ -121,8 +121,6 @@ abstract class BlockBase extends PluginBase implements BlockPluginInterface {
* Most block plugins should not override this method. To add validation * Most block plugins should not override this method. To add validation
* for a specific block type, override BlockBase::blockValdiate(). * for a specific block type, override BlockBase::blockValdiate().
* *
* @todo Add inline documentation to this method.
*
* @see \Drupal\block\BlockBase::blockValidate() * @see \Drupal\block\BlockBase::blockValidate()
*/ */
public function validateConfigurationForm(array &$form, array &$form_state) { public function validateConfigurationForm(array &$form, array &$form_state) {
@ -140,11 +138,10 @@ abstract class BlockBase extends PluginBase implements BlockPluginInterface {
* Most block plugins should not override this method. To add submission * Most block plugins should not override this method. To add submission
* handling for a specific block type, override BlockBase::blockSubmit(). * handling for a specific block type, override BlockBase::blockSubmit().
* *
* @todo Add inline documentation to this method.
*
* @see \Drupal\block\BlockBase::blockSubmit() * @see \Drupal\block\BlockBase::blockSubmit()
*/ */
public function submitConfigurationForm(array &$form, array &$form_state) { public function submitConfigurationForm(array &$form, array &$form_state) {
// Process the block's submission handling if no errors occurred only.
if (!form_get_errors()) { if (!form_get_errors()) {
$this->configuration['label'] = $form_state['values']['label']; $this->configuration['label'] = $form_state['values']['label'];
$this->configuration['label_display'] = $form_state['values']['label_display']; $this->configuration['label_display'] = $form_state['values']['label_display'];

View File

@ -299,9 +299,11 @@ class BlockFormController extends EntityFormController {
form_set_value($form['id'], $form_state['values']['theme'] . '.' . $form_state['values']['machine_name'], $form_state); form_set_value($form['id'], $form_state['values']['theme'] . '.' . $form_state['values']['machine_name'], $form_state);
} }
if (!empty($form['machine_name']['#disabled'])) { if (!empty($form['machine_name']['#disabled'])) {
// Get machine name from original value (without prepended theme name).
$config_id = explode('.', $form_state['values']['machine_name']); $config_id = explode('.', $form_state['values']['machine_name']);
$form_state['values']['machine_name'] = array_pop($config_id); $form_state['values']['machine_name'] = array_pop($config_id);
} }
// Remove empty lines from the role visibility list.
$form_state['values']['visibility']['role']['roles'] = array_filter($form_state['values']['visibility']['role']['roles']); $form_state['values']['visibility']['role']['roles'] = array_filter($form_state['values']['visibility']['role']['roles']);
// The Block Entity form puts all block plugin form elements in the // The Block Entity form puts all block plugin form elements in the
// settings form element, so just pass that to the block for validation. // settings form element, so just pass that to the block for validation.
@ -331,6 +333,8 @@ class BlockFormController extends EntityFormController {
$entity->save(); $entity->save();
drupal_set_message($this->t('The block configuration has been saved.')); drupal_set_message($this->t('The block configuration has been saved.'));
// Invalidate the content cache and redirect to the block listing,
// because we need to remove cached block contents for each cache backend.
Cache::invalidateTags(array('content' => TRUE)); Cache::invalidateTags(array('content' => TRUE));
$form_state['redirect'] = array('admin/structure/block/list/' . $form_state['values']['theme'], array( $form_state['redirect'] = array('admin/structure/block/list/' . $form_state['values']['theme'], array(
'query' => array('block-placement' => drupal_html_class($this->entity->id())), 'query' => array('block-placement' => drupal_html_class($this->entity->id())),