Commit 6a6e601d authored by webchick's avatar webchick

Issue #2309323 by Berdir, tim.plunkett: Allow #submit and #validate to be...

Issue #2309323 by Berdir, tim.plunkett: Allow #submit and #validate to be specified as methods of the form object.
parent 37586d97
......@@ -138,7 +138,7 @@ public function form(array $form, FormStateInterface $form_state) {
$entity = $this->entity;
// Add a process callback.
$form['#process'][] = array($this, 'processForm');
$form['#process'][] = '::processForm';
if (!isset($form['langcode'])) {
// If the form did not specify otherwise, default to keeping the existing
......@@ -210,13 +210,8 @@ protected function actions(array $form, FormStateInterface $form_state) {
$actions['submit'] = array(
'#type' => 'submit',
'#value' => $this->t('Save'),
'#validate' => array(
array($this, 'validate'),
),
'#submit' => array(
array($this, 'submit'),
array($this, 'save'),
),
'#validate' => array('::validate'),
'#submit' => array('::submit', '::save'),
);
if (!$this->entity->isNew() && $this->entity->hasLinkTemplate('delete-form')) {
......@@ -317,11 +312,6 @@ protected function updateFormLangcode(FormStateInterface $form_state) {
*/
public function buildEntity(array $form, FormStateInterface $form_state) {
$entity = clone $this->entity;
// If you submit a form, the form state comes from caching, which forces
// the form object to be the one before caching. Ensure to have the
// form object of the current request.
$form_state['controller'] = $this;
$this->copyFormValuesToEntity($entity, $form, $form_state);
// Invoke all specified builders for copying form values to entity
......
......@@ -639,8 +639,8 @@ public function prepareForm($form_id, &$form, FormStateInterface &$form_state) {
$form += $this->getElementInfo('form');
$form += array('#tree' => FALSE, '#parents' => array());
$form['#validate'][] = array($form_state['build_info']['callback_object'], 'validateForm');
$form['#submit'][] = array($form_state['build_info']['callback_object'], 'submitForm');
$form['#validate'][] = '::validateForm';
$form['#submit'][] = '::submitForm';
// If no #theme has been set, automatically apply theme suggestions.
// theme_form() itself is in #theme_wrappers and not #theme. Therefore, the
......@@ -767,9 +767,9 @@ public function doBuildForm($form_id, &$element, FormStateInterface &$form_state
// Allow for elements to expand to multiple elements, e.g., radios,
// checkboxes and files.
if (isset($element['#process']) && !$element['#processed']) {
foreach ($element['#process'] as $process) {
foreach ($element['#process'] as $callback) {
$complete_form = &$form_state->getCompleteForm();
$element = call_user_func_array($process, array(&$element, &$form_state, &$complete_form));
$element = call_user_func_array($form_state->prepareCallback($callback), array(&$element, &$form_state, &$complete_form));
}
$element['#processed'] = TRUE;
}
......
......@@ -796,6 +796,17 @@ public function setRebuild($rebuild = TRUE) {
return $this;
}
/**
* {@inheritdoc}
*/
public function prepareCallback($callback) {
if (is_string($callback) && substr($callback, 0, 2) == '::') {
$callback = array($this->get('build_info')['callback_object'], substr($callback, 2));
}
return $callback;
}
/**
* Wraps drupal_set_message().
*
......
......@@ -456,4 +456,18 @@ public function getError($element);
*/
public function setRebuild($rebuild = TRUE);
/**
* Converts support notations for a form callback to a valid callable.
*
* Specifically, supports methods on the form/callback object as strings when
* they start with ::, for example "::submitForm()".
*
* @param string|array $callback
* The callback.
*
* @return array|string
* A valid callable.
*/
public function prepareCallback($callback);
}
......@@ -105,7 +105,7 @@ public function executeSubmitHandlers(&$form, FormStateInterface &$form_state) {
$handlers = array();
}
foreach ($handlers as $function) {
foreach ($handlers as $callback) {
// Check if a previous _submit handler has set a batch, but make sure we
// do not react to a batch that is already being processed (for instance
// if a batch operation performs a
......@@ -114,11 +114,11 @@ public function executeSubmitHandlers(&$form, FormStateInterface &$form_state) {
// Some previous submit handler has set a batch. To ensure correct
// execution order, store the call in a special 'control' batch set.
// See _batch_next_set().
$batch['sets'][] = array('form_submit' => $function);
$batch['sets'][] = array('form_submit' => $callback);
$batch['has_form_submits'] = TRUE;
}
else {
call_user_func_array($function, array(&$form, &$form_state));
call_user_func_array($form_state->prepareCallback($callback), array(&$form, &$form_state));
}
}
}
......
......@@ -79,8 +79,8 @@ public function executeValidateHandlers(&$form, FormStateInterface &$form_state)
$handlers = array();
}
foreach ($handlers as $function) {
call_user_func_array($function, array(&$form, &$form_state));
foreach ($handlers as $callback) {
call_user_func_array($form_state->prepareCallback($callback), array(&$form, &$form_state));
}
}
......@@ -263,7 +263,7 @@ protected function doValidateForm(&$elements, FormStateInterface &$form_state, $
elseif (isset($elements['#element_validate'])) {
foreach ($elements['#element_validate'] as $callback) {
$complete_form = &$form_state->getCompleteForm();
call_user_func_array($callback, array(&$elements, &$form_state, &$complete_form));
call_user_func_array($form_state->prepareCallback($callback), array(&$elements, &$form_state, &$complete_form));
}
}
......
......@@ -104,7 +104,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
array('driver'),
array($default_driver),
),
'#submit' => array(array($this, 'submitForm')),
'#submit' => array('::submitForm'),
);
$form['errors'] = array();
......
......@@ -101,7 +101,7 @@ public function form(array $form, FormStateInterface $form_state) {
'#title' => t('Theme'),
'#default_value' => $theme,
'#ajax' => array(
'callback' => array($this, 'themeSwitch'),
'callback' => '::themeSwitch',
'wrapper' => 'edit-block-region-wrapper',
),
);
......
......@@ -244,13 +244,8 @@ protected function actions(array $form, FormStateInterface $form_state) {
'#type' => 'submit',
'#value' => $this->t('Preview'),
'#access' => $preview_mode != DRUPAL_DISABLED,
'#validate' => array(
array($this, 'validate'),
),
'#submit' => array(
array($this, 'submit'),
array($this, 'preview'),
),
'#validate' => array('::validate'),
'#submit' => array('::submit', '::preview'),
);
return $element;
......
......@@ -95,7 +95,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $config_t
'#options' => $config_types,
'#default_value' => $config_type,
'#ajax' => array(
'callback' => array($this, 'updateConfigurationType'),
'callback' => '::updateConfigurationType',
'wrapper' => 'edit-config-type-wrapper',
),
);
......@@ -109,7 +109,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $config_t
'#prefix' => '<div id="edit-config-type-wrapper">',
'#suffix' => '</div>',
'#ajax' => array(
'callback' => array($this, 'updateExport'),
'callback' => '::updateExport',
'wrapper' => 'edit-export-wrapper',
),
);
......
......@@ -156,13 +156,8 @@ public function actions(array $form, FormStateInterface $form_state) {
$elements['submit']['#value'] = $this->t('Send message');
$elements['preview'] = array(
'#value' => $this->t('Preview'),
'#validate' => array(
array($this, 'validate'),
),
'#submit' => array(
array($this, 'submit'),
array($this, 'preview'),
),
'#validate' => array('::validate'),
'#submit' => array('::submit', '::preview'),
);
return $elements;
}
......
......@@ -59,7 +59,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#type' => 'submit',
'#value' => $this->t('Reset'),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'resetForm')),
'#submit' => array('::resetForm'),
);
}
return $form;
......
......@@ -189,7 +189,7 @@ public function buildForm(array $form, FormStateInterface $form_state, FilterFor
// No regular submit-handler. This form only works via JavaScript.
'#submit' => array(),
'#ajax' => array(
'callback' => array($this, 'submitForm'),
'callback' => '::submitForm',
'event' => 'click',
),
);
......
......@@ -69,7 +69,7 @@ public function buildForm(array $form, FormStateInterface $form_state, FilterFor
// No regular submit-handler. This form only works via JavaScript.
'#submit' => array(),
'#ajax' => array(
'callback' => array($this, 'submitForm'),
'callback' => '::submitForm',
'event' => 'click',
),
);
......
......@@ -157,7 +157,7 @@ public function buildForm(array $form, FormStateInterface $form_state, FieldInst
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => $this->t('Delete field'),
'#submit' => array(array($this, 'delete')),
'#submit' => array('::delete'),
);
return $form;
}
......
......@@ -99,7 +99,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
// The form needs to have submit and validate handlers set explicitly.
// Use the existing taxonomy overview submit handler.
$form['#submit'] = array(array($this, 'submitForm'));
$form['#submit'] = array('::submitForm');
$form['terms']['#empty'] = $this->t('No containers or forums available. <a href="@container">Add container</a> or <a href="@forum">Add forum</a>.', array(
'@container' => $this->url('forum.add_container'),
'@forum' => $this->url('forum.add_forum')
......
......@@ -49,8 +49,8 @@ public function form(array $form, FormStateInterface $form_state) {
'select#edit-predefined-langcode' => array('value' => 'custom'),
),
),
'#validate' => array(array($this, 'validatePredefined')),
'#submit' => array(array($this, 'submitForm')),
'#validate' => array('::validatePredefined'),
'#submit' => array('::submitForm'),
);
$custom_language_states_conditions = array(
......@@ -72,8 +72,8 @@ public function form(array $form, FormStateInterface $form_state) {
$form['custom_language']['submit'] = array(
'#type' => 'submit',
'#value' => $this->t('Add custom language'),
'#validate' => array(array($this, 'validateCustom')),
'#submit' => array(array($this, 'submitForm')),
'#validate' => array('::validateCustom'),
'#submit' => array('::submitForm'),
);
return $form;
......
......@@ -38,8 +38,8 @@ public function actions(array $form, FormStateInterface $form_state) {
$actions['submit'] = array(
'#type' => 'submit',
'#value' => $this->t('Save language'),
'#validate' => array(array($this, 'validateCommon')),
'#submit' => array(array($this, 'submitForm')),
'#validate' => array('::validateCommon'),
'#submit' => array('::submitForm'),
);
return $actions;
}
......
......@@ -74,7 +74,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['filters']['actions']['reset'] = array(
'#type' => 'submit',
'#value' => $this->t('Reset'),
'#submit' => array(array($this, 'resetForm')),
'#submit' => array('::resetForm'),
);
}
......
......@@ -288,7 +288,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
$element['publish']['#value'] = $node->isPublished() ? t('Save and keep published') : t('Save and publish');
}
$element['publish']['#weight'] = 0;
array_unshift($element['publish']['#submit'], array($this, 'publish'));
array_unshift($element['publish']['#submit'], '::publish');
// Add a "Unpublish" button.
$element['unpublish'] = $element['submit'];
......@@ -300,7 +300,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
$element['unpublish']['#value'] = !$node->isPublished() ? t('Save and keep unpublished') : t('Save and unpublish');
}
$element['unpublish']['#weight'] = 10;
array_unshift($element['unpublish']['#submit'], array($this, 'unpublish'));
array_unshift($element['unpublish']['#submit'], '::unpublish');
// If already published, the 'publish' button is primary.
if ($node->isPublished()) {
......@@ -321,13 +321,8 @@ protected function actions(array $form, FormStateInterface $form_state) {
'#access' => $preview_mode != DRUPAL_DISABLED && ($node->access('create') || $node->access('update')),
'#value' => t('Preview'),
'#weight' => 20,
'#validate' => array(
array($this, 'validate'),
),
'#submit' => array(
array($this, 'submit'),
array($this, 'preview'),
),
'#validate' => array('::validate'),
'#submit' => array('::submit', '::preview'),
);
$element['delete']['#access'] = $node->access('delete');
......
......@@ -44,7 +44,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $pid = NU
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => $this->t('Delete'),
'#submit' => array(array($this, 'deleteSubmit')),
'#submit' => array('::deleteSubmit'),
);
return $form;
}
......
......@@ -50,7 +50,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $keys = N
$form['basic']['reset'] = array(
'#type' => 'submit',
'#value' => $this->t('Reset'),
'#submit' => array(array($this, 'resetForm')),
'#submit' => array('::resetForm'),
);
}
return $form;
......
......@@ -185,7 +185,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['status']['wipe'] = array(
'#type' => 'submit',
'#value' => $this->t('Re-index site'),
'#submit' => array(array($this, 'searchAdminReindexSubmit')),
'#submit' => array('::searchAdminReindexSubmit'),
);
$items = array(10, 20, 50, 100, 200, 500);
......@@ -271,8 +271,8 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['search_pages']['add_page']['add_search_submit'] = array(
'#type' => 'submit',
'#value' => $this->t('Add new page'),
'#validate' => array(array($this, 'validateAddSearchPage')),
'#submit' => array(array($this, 'submitAddSearchPage')),
'#validate' => array('::validateAddSearchPage'),
'#submit' => array('::submitAddSearchPage'),
'#limit_validation_errors' => array(array('search_type')),
);
......
......@@ -89,10 +89,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
'submit' => array(
'#value' => t('Save changes'),
'#access' => (bool) Element::getVisibleChildren($form['shortcuts']['links']),
'#submit' => array(
array($this, 'submit'),
array($this, 'save'),
),
'#submit' => array('::submit', '::save'),
),
);
}
......
......@@ -72,9 +72,11 @@ public function content(Request $request) {
// up to the #ajax['callback'] function of the element (may or may not be a
// button) that triggered the Ajax request to determine what needs to be
// rendered.
$callback = NULL;
if (!empty($form_state['triggering_element'])) {
$callback = $form_state['triggering_element']['#ajax']['callback'];
}
$callback = $form_state->prepareCallback($callback);
if (empty($callback) || !is_callable($callback)) {
throw new HttpException(500, t('Internal Server Error'));
}
......
......@@ -92,7 +92,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['run'] = array(
'#type' => 'submit',
'#value' => t('Run cron'),
'#submit' => array(array($this, 'submitCron')),
'#submit' => array('::submitCron'),
);
$status = '<p>' . t('Last run: %cron-last ago.', array('%cron-last' => $this->dateFormatter->formatInterval(REQUEST_TIME - $this->state->get('system.cron_last')))) . '</p>';
......
......@@ -135,7 +135,7 @@ public function form(array $form, FormStateInterface $form_state) {
'#default_value' => '',
'#field_suffix' => ' <small id="edit-date-format-suffix"></small>',
'#ajax' => array(
'callback' => array($this, 'dateTimeLookup'),
'callback' => '::dateTimeLookup',
'event' => 'keyup',
'progress' => array('type' => 'throbber', 'message' => NULL),
),
......
......@@ -107,7 +107,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['clear_cache']['clear'] = array(
'#type' => 'submit',
'#value' => t('Clear all caches'),
'#submit' => array(array($this, 'submitCacheClear')),
'#submit' => array('::submitCacheClear'),
);
$form['caching'] = array(
......
......@@ -37,8 +37,8 @@ public function getFormId() {
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['#validate'][] = array($this, 'customValidateForm');
$form['#submit'][] = array($this, 'customSubmitForm');
$form['#validate'][] = '::customValidateForm';
$form['#submit'][] = '::customSubmitForm';
$form['submit'] = array('#type' => 'submit', '#value' => 'Save');
return $form;
}
......
......@@ -42,7 +42,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#name' => 'button1',
'#value' => 'Button 1 (modal)',
'#ajax' => array(
'callback' => array($this, 'modal'),
'callback' => '::modal',
),
);
$form['button2'] = array(
......@@ -50,7 +50,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#name' => 'button2',
'#value' => 'Button 2 (non-modal)',
'#ajax' => array(
'callback' => array($this, 'nonModal'),
'callback' => '::nonModal',
),
);
......
......@@ -35,7 +35,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['test'] = array(
'#title' => 'Test',
'#type' => 'textfield',
'#element_validate' => array(array($this, 'elementValidateLimitValidationErrors')),
'#element_validate' => array('::elementValidateLimitValidationErrors'),
);
$form['test_numeric_index'] = array(
'#tree' => TRUE,
......@@ -43,7 +43,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['test_numeric_index'][0] = array(
'#title' => 'Test (numeric index)',
'#type' => 'textfield',
'#element_validate' => array(array($this, 'elementValidateLimitValidationErrors')),
'#element_validate' => array('::elementValidateLimitValidationErrors'),
);
$form['test_substring'] = array(
......@@ -52,30 +52,30 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['test_substring']['foo'] = array(
'#title' => 'Test (substring) foo',
'#type' => 'textfield',
'#element_validate' => array(array($this, 'elementValidateLimitValidationErrors')),
'#element_validate' => array('::elementValidateLimitValidationErrors'),
);
$form['test_substring']['foobar'] = array(
'#title' => 'Test (substring) foobar',
'#type' => 'textfield',
'#element_validate' => array(array($this, 'elementValidateLimitValidationErrors')),
'#element_validate' => array('::elementValidateLimitValidationErrors'),
);
$form['actions']['partial'] = array(
'#type' => 'submit',
'#limit_validation_errors' => array(array('test')),
'#submit' => array(array($this, 'partialSubmitForm')),
'#submit' => array('::partialSubmitForm'),
'#value' => t('Partial validate'),
);
$form['actions']['partial_numeric_index'] = array(
'#type' => 'submit',
'#limit_validation_errors' => array(array('test_numeric_index', 0)),
'#submit' => array(array($this, 'partialSubmitForm')),
'#submit' => array('::partialSubmitForm'),
'#value' => t('Partial validate (numeric index)'),
);
$form['actions']['substring'] = array(
'#type' => 'submit',
'#limit_validation_errors' => array(array('test_substring', 'foo')),
'#submit' => array(array($this, 'partialSubmitForm')),
'#submit' => array('::partialSubmitForm'),
'#value' => t('Partial validate (substring)'),
);
$form['actions']['full'] = array(
......
......@@ -74,7 +74,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
// Use the same submit handler for this button as for the form itself.
// (This must be set explicitly or otherwise the form API will ignore the
// #limit_validation_errors property.)
'#submit' => array(array($this, 'submitForm')),
'#submit' => array('::submitForm'),
);
$user_input = $form_state->getUserInput();
if (!empty($user_input['field_to_validate']) && $user_input['field_to_validate'] != 'all') {
......
......@@ -53,7 +53,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['add_more'] = array(
'#type' => 'submit',
'#value' => 'Add more',
'#submit' => array(array($this, 'addMoreSubmitForm')),
'#submit' => array('::addMoreSubmitForm'),
);
}
else {
......
......@@ -63,7 +63,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#type' => 'textfield',
'#title' => 'Value',
'#default_value' => $form_state['storage']['thing']['value'],
'#element_validate' => array(array($this, 'elementValidateValueCached')),
'#element_validate' => array('::elementValidateValueCached'),
);
$form['continue_button'] = array(
'#type' => 'button',
......@@ -73,7 +73,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['continue_submit'] = array(
'#type' => 'submit',
'#value' => 'Continue submit',
'#submit' => array(array($this, 'continueSubmitForm')),
'#submit' => array('::continueSubmitForm'),
);
$form['submit'] = array(
'#type' => 'submit',
......
......@@ -27,7 +27,7 @@ public function getFormId() {
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$options = array('foo' => 'foo', 'bar' => 'bar');
$validate = array(array($this, 'elementValidateRequired'));
$validate = array('::elementValidateRequired');
$form['textfield'] = array(
'#type' => 'textfield',
......
......@@ -339,7 +339,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Vocabular
);
$form['actions']['reset_alphabetical'] = array(
'#type' => 'submit',
'#submit' => array(array($this, 'submitReset')),
'#submit' => array('::submitReset'),
'#value' => $this->t('Reset to alphabetical'),
);
}
......
......@@ -97,7 +97,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
// the submit button has custom submit handlers.
if ($this->moduleHandler->moduleExists('language')) {
array_unshift($actions['submit']['#submit'], 'language_configuration_element_submit');
array_unshift($actions['submit']['#submit'], array($this, 'languageConfigurationSubmit'));
array_unshift($actions['submit']['#submit'], '::languageConfigurationSubmit');
}
// We cannot leverage the regular submit handler definition because we
// have button-specific ones here. Hence we need to explicitly set it for
......
......@@ -105,9 +105,9 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Log in'));
$form['#validate'][] = array($this, 'validateName');
$form['#validate'][] = array($this, 'validateAuthentication');
$form['#validate'][] = array($this, 'validateFinal');
$form['#validate'][] = '::validateName';
$form['#validate'][] = '::validateAuthentication';
$form['#validate'][] = '::validateFinal';
return $form;
}
......
......@@ -37,7 +37,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
$user = $this->currentUser();
$element['delete']['#type'] = 'submit';
$element['delete']['#value'] = $this->t('Cancel account');
$element['delete']['#submit'] = array(array($this, 'editCancelSubmit'));
$element['delete']['#submit'] = array('::editCancelSubmit');
$element['delete']['#access'] = $account->id() > 1 && (($account->id() == $user->id() && $user->hasPermission('cancel account')) || $user->hasPermission('administer users'));
return $element;
......
......@@ -46,7 +46,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
$form['cache']['clear_cache'] = array(
'#type' => 'submit',
'#value' => $this->t("Clear Views' cache"),
'#submit' => array(array($this, 'cacheSubmit')),
'#submit' => array('::cacheSubmit'),
);
$form['debug'] = array(
......
......@@ -153,9 +153,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
$actions['cancel'] = array(
'#type' => 'submit',
'#value' => $this->t('Cancel'),
'#submit' => array(
array($this, 'cancel'),
),
'#submit' => array('::cancel'),
'#limit_validation_errors' => array(),
);
return $actions;
......
......@@ -58,9 +58,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
$actions['submit'] = array(
'#type' => 'submit',
'#value' => $this->t('Duplicate'),
'#submit' => array(
array($this, 'submit'),
),
'#submit' => array('::submit'),
);
return $actions;
}
......
......@@ -240,9 +240,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
$actions['cancel'] = array(
'#type' => 'submit',
'#value' => $this->t('Cancel'),
'#submit' => array(
array($this, 'cancel'),
),
'#submit' => array('::cancel'),
);
if ($this->entity->isLocked()) {
$actions['submit']['#access'] = FALSE;
......@@ -418,7 +416,7 @@ public function getDisplayDetails($view, $display) {
'#type' => 'submit',
'#value' => $this->t('Enable !display_title', array('!display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayEnable'), array($this, 'submitDelayDestination')),
'#submit' => array('::submitDisplayEnable', '::submitDelayDestination'),
'#prefix' => '<li class="enable">',
"#suffix" => '</li>',
);
......@@ -443,7 +441,7 @@ public function getDisplayDetails($view, $display) {
'#type' => 'submit',
'#value' => $this->t('Duplicate !display_title', array('!display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayDuplicate'), array($this, 'submitDelayDestination')),
'#submit' => array('::submitDisplayDuplicate', '::submitDelayDestination'),
'#prefix' => '<li class="duplicate">',
"#suffix" => '</li>',
);
......@@ -453,7 +451,7 @@ public function getDisplayDetails($view, $display) {
'#type' => 'submit',
'#value' => $this->t('Delete !display_title', array('!display_title' => $display_title)),