Issue #1879396 by babruix, jibran, xjm, juanolalla: Add inline docs to block classes
parent
19aeaa740b
commit
a7d2952106
|
@ -121,8 +121,6 @@ abstract class BlockBase extends PluginBase implements BlockPluginInterface {
|
|||
* Most block plugins should not override this method. To add validation
|
||||
* for a specific block type, override BlockBase::blockValdiate().
|
||||
*
|
||||
* @todo Add inline documentation to this method.
|
||||
*
|
||||
* @see \Drupal\block\BlockBase::blockValidate()
|
||||
*/
|
||||
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
|
||||
* handling for a specific block type, override BlockBase::blockSubmit().
|
||||
*
|
||||
* @todo Add inline documentation to this method.
|
||||
*
|
||||
* @see \Drupal\block\BlockBase::blockSubmit()
|
||||
*/
|
||||
public function submitConfigurationForm(array &$form, array &$form_state) {
|
||||
// Process the block's submission handling if no errors occurred only.
|
||||
if (!form_get_errors()) {
|
||||
$this->configuration['label'] = $form_state['values']['label'];
|
||||
$this->configuration['label_display'] = $form_state['values']['label_display'];
|
||||
|
|
|
@ -299,9 +299,11 @@ class BlockFormController extends EntityFormController {
|
|||
form_set_value($form['id'], $form_state['values']['theme'] . '.' . $form_state['values']['machine_name'], $form_state);
|
||||
}
|
||||
if (!empty($form['machine_name']['#disabled'])) {
|
||||
// Get machine name from original value (without prepended theme name).
|
||||
$config_id = explode('.', $form_state['values']['machine_name']);
|
||||
$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']);
|
||||
// The Block Entity form puts all block plugin form elements in the
|
||||
// settings form element, so just pass that to the block for validation.
|
||||
|
@ -331,6 +333,8 @@ class BlockFormController extends EntityFormController {
|
|||
$entity->save();
|
||||
|
||||
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));
|
||||
$form_state['redirect'] = array('admin/structure/block/list/' . $form_state['values']['theme'], array(
|
||||
'query' => array('block-placement' => drupal_html_class($this->entity->id())),
|
||||
|
|
Loading…
Reference in New Issue