diff --git a/core/modules/user/src/ProfileTranslationHandler.php b/core/modules/user/src/ProfileTranslationHandler.php index c332d83..c9b7125 100644 --- a/core/modules/user/src/ProfileTranslationHandler.php +++ b/core/modules/user/src/ProfileTranslationHandler.php @@ -20,7 +20,7 @@ class ProfileTranslationHandler extends ContentTranslationHandler { */ public function entityFormAlter(array &$form, array &$form_state, EntityInterface $entity) { parent::entityFormAlter($form, $form_state, $entity); - $form['actions']['submit']['#submit'][] = array($this, 'entityFormSave'); + $form['actions']['submit']['#submit'][] = 'entityFormSave'; } /** diff --git a/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php b/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php index cc34f74..bb3e60a 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormSubmitterTest.php @@ -230,13 +230,16 @@ public function providerTestRedirectWithoutResult() { */ public function testExecuteSubmitHandlers() { $form_submitter = $this->getFormSubmitter(); - $mock = $this->getMock('stdClass', array('submit_handler', 'hash_submit')); + $mock = $this->getMock('stdClass', array('submit_handler', 'hash_submit', 'simple_string_submit')); $mock->expects($this->once()) ->method('submit_handler') ->with($this->isType('array'), $this->isType('array')); $mock->expects($this->once()) ->method('hash_submit') ->with($this->isType('array'), $this->isType('array')); + $mock->expects($this->once()) + ->method('simple_string_submit') + ->with($this->isType('array'), $this->isType('array')); $form = array(); $form_state = $this->getFormStateDefaults(); @@ -248,6 +251,12 @@ public function testExecuteSubmitHandlers() { // $form_state submit handlers will supersede $form handlers. $form_state['submit_handlers'][] = array($mock, 'submit_handler'); $form_submitter->executeSubmitHandlers($form, $form_state); + + // Methods directly on the form object can be specified as a string. + $form_state = $this->getFormStateDefaults(); + $form_state['build_info']['callback_object'] = $mock; + $form_state['submit_handlers'][] = 'simple_string_submit'; + $form_submitter->executeSubmitHandlers($form, $form_state); } /**