commit 0ac178c7298b2b42d83de325f5028730be2e9e22 Author: Bart Feenstra Date: Wed Apr 16 14:59:54 2014 +0200 foo diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php index 4e7f961..b177a2a 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormController.php +++ b/core/lib/Drupal/Core/Entity/EntityFormController.php @@ -189,7 +189,6 @@ protected function actionsElement(array $form, array &$form_state) { $count = 0; foreach (Element::children($element) as $action) { $element[$action] += array( - '#type' => 'submit', '#weight' => ++$count * 5, ); } @@ -203,30 +202,42 @@ protected function actionsElement(array $form, array &$form_state) { /** * Returns an array of supported actions for the current entity form. + * + * @todo Consider introducing a 'preview' action here, since it is used by + * many entity types. */ protected function actions(array $form, array &$form_state) { - return array( - // @todo Rename the action key from submit to save. - 'submit' => array( - '#value' => $this->t('Save'), - '#validate' => array( - array($this, 'validate'), - ), - '#submit' => array( - array($this, 'submit'), - array($this, 'save'), - ), + // @todo Rename the action key from submit to save. + $actions['submit'] = array( + '#type' => 'submit', + '#value' => $this->t('Save'), + '#validate' => array( + array($this, 'validate'), ), - 'delete' => array( - '#value' => $this->t('Delete'), - // No need to validate the form when deleting the entity. - '#submit' => array( - array($this, 'delete'), - ), + '#submit' => array( + array($this, 'submit'), + array($this, 'save'), ), - // @todo Consider introducing a 'preview' action here, since it is used by - // many entity types. ); + + if (!$this->entity->isNew() && $this->entity->hasLinkTemplate('delete-form')) { + $route_info = $this->entity->urlInfo('delete-form'); + if ($this->getRequest()->query->has('destination')) { + $query = $route_info->getOption('query'); + $query['destination'] = $this->getRequest()->query->get('destination'); + $route_info->setOption('query', $query); + } + $actions['delete'] = array( + '#type' => 'link', + '#title' => $this->t('Delete'), + '#attributes' => array( + 'class' => array('button', 'button--danger'), + ), + ); + $actions['delete'] += $route_info->toRenderArray(); + } + + return $actions; } /** @@ -274,28 +285,6 @@ public function save(array $form, array &$form_state) { } /** - * Form submission handler for the 'delete' action. - * - * @param array $form - * An associative array containing the structure of the form. - * @param array $form_state - * A reference to a keyed array containing the current state of the form. - */ - public function delete(array $form, array &$form_state) { - if ($this->entity->hasLinkTemplate('delete-form')) { - $form_state['redirect_route'] = $this->entity->urlInfo('delete-form'); - - $query = $this->getRequest()->query; - if ($query->has('destination')) { - $redirect_query = $form_state['redirect_route']->getOption('query') ?: array(); - $redirect_query['destination'] = $query->get('destination'); - $form_state['redirect_route']->setOption('query', $redirect_query); - $query->remove('destination'); - } - } - } - - /** * {@inheritdoc} */ public function getFormLangcode(array &$form_state) { diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php index 7feb2c0..8062fb5 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php @@ -70,7 +70,7 @@ public function testPageEdit() { // Test deleting the block. $this->drupalGet("block/" . $revised_block->id()); - $this->drupalPostForm(NULL, array(), t('Delete')); + $this->clickLink(t('Delete')); $this->assertText(format_string('Are you sure you want to delete !label?', array('!label' => $revised_block->label()))); } diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php index 1a0fd00..ec6909c 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php @@ -138,7 +138,7 @@ function testBlock() { // Test deleting the block from the edit form. $this->drupalGet('admin/structure/block/manage/' . $block['id']); - $this->drupalPostForm(NULL, array(), t('Delete')); + $this->clickLink(t('Delete')); $this->assertRaw(t('Are you sure you want to delete the block %name?', array('%name' => $block['settings[label]']))); $this->drupalPostForm(NULL, array(), t('Delete')); $this->assertRaw(t('The block %name has been removed.', array('%name' => $block['settings[label]']))); @@ -146,7 +146,7 @@ function testBlock() { // Test deleting a block via "Configure block" link. $block = $this->drupalPlaceBlock('system_powered_by_block'); $this->drupalGet('admin/structure/block/manage/' . $block->id(), array('query' => array('destination' => 'admin'))); - $this->drupalPostForm(NULL, array(), t('Delete')); + $this->clickLink(t('Delete')); $this->assertRaw(t('Are you sure you want to delete the block %name?', array('%name' => $block->label()))); $this->drupalPostForm(NULL, array(), t('Delete')); $this->assertRaw(t('The block %name has been removed.', array('%name' => $block->label()))); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php index a2e1975..5f405b1 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php @@ -272,7 +272,7 @@ function testCRUDUI() { // Delete the configuration entity. $this->drupalGet("admin/structure/config_test/manage/$id"); - $this->drupalPostForm(NULL, array(), 'Delete'); + $this->clickLink(t('Delete')); $this->assertUrl("admin/structure/config_test/manage/$id/delete"); $this->drupalPostForm(NULL, array(), 'Delete'); $this->assertUrl('admin/structure/config_test'); diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayModeTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayModeTest.php index 133b8c3..177d4df 100644 --- a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayModeTest.php +++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayModeTest.php @@ -69,7 +69,7 @@ public function testEntityViewModeUI() { $this->drupalGet('admin/structure/display-modes/view/manage/entity_test.' . $edit['id']); // Test deleting the view mode. - $this->drupalPostForm(NULL, NULL, t('Delete')); + $this->clickLink(t('Delete')); $this->assertRaw(t('Are you sure you want to delete the %label view mode?', array('%label' => $edit['label']))); $this->drupalPostForm(NULL, NULL, t('Delete')); $this->assertRaw(t('Deleted the %label view mode.', array('%label' => $edit['label']))); @@ -115,7 +115,7 @@ public function testEntityFormModeUI() { $this->drupalGet('admin/structure/display-modes/form/manage/entity_test.' . $edit['id']); // Test deleting the form mode. - $this->drupalPostForm(NULL, NULL, t('Delete')); + $this->clickLink(t('Delete')); $this->assertRaw(t('Are you sure you want to delete the %label form mode?', array('%label' => $edit['label']))); $this->drupalPostForm(NULL, NULL, t('Delete')); $this->assertRaw(t('Deleted the %label form mode.', array('%label' => $edit['label']))); diff --git a/core/modules/forum/lib/Drupal/forum/Form/ForumFormController.php b/core/modules/forum/lib/Drupal/forum/Form/ForumFormController.php index 1a55da2..9ac2e88 100644 --- a/core/modules/forum/lib/Drupal/forum/Form/ForumFormController.php +++ b/core/modules/forum/lib/Drupal/forum/Form/ForumFormController.php @@ -101,16 +101,20 @@ public function save(array $form, array &$form_state) { /** * {@inheritdoc} */ - public function delete(array $form, array &$form_state) { - $form_state['redirect_route'] = $this->entity->urlInfo('forum-delete-form'); - - $query = $this->getRequest()->query; - if ($query->has('destination')) { - $redirect_query = $form_state['redirect_route']->getOption('query') ?: array(); - $redirect_query['destination'] = $query->get('destination'); - $form_state['redirect_route']->setOption('query', $redirect_query); - $query->remove('destination'); + protected function actions(array $form, array &$form_state) { + $actions = parent::actions($form, $form_state); + + if (!$this->entity->isNew() && $this->entity->hasLinkTemplate('forum-delete-form')) { + $route_info = $this->entity->urlInfo('forum-delete-form'); + $actions['delete']['#options'] = $route_info->getOptions(); + $actions['delete']['#route_name'] = $route_info->getRouteName(); + $actions['delete']['#route_parameters'] = $route_info->getRouteParameters(); } + else { + unset($actions['delete']); + } + + return $actions; } /** diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php index 3aebca3..6217835 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php @@ -307,7 +307,7 @@ private function doAdminTests($user) { // Test tags vocabulary form is not affected. $this->drupalGet('admin/structure/taxonomy/manage/tags'); $this->assertFieldByName('op', t('Save'), 'Save button found.'); - $this->assertFieldByName('op', t('Delete'), 'Delete button found.'); + $this->assertLink(t('Delete')); // Test tags vocabulary term form is not affected. $this->drupalGet('admin/structure/taxonomy/manage/tags/add'); $this->assertField('parent[]', 'Parent field found.'); @@ -408,7 +408,8 @@ function createForum($type, $parent = 0) { */ function deleteForum($tid) { // Delete the forum. - $this->drupalPostForm('admin/structure/forum/edit/forum/' . $tid, array(), t('Delete')); + $this->drupalGet('admin/structure/forum/edit/forum/' . $tid); + $this->clickLink(t('Delete')); $this->assertText('Are you sure you want to delete the forum'); $this->assertNoText('Add forum'); $this->assertNoText('Add forum container'); diff --git a/core/modules/node/lib/Drupal/node/NodeFormController.php b/core/modules/node/lib/Drupal/node/NodeFormController.php index da55f5f..8524580 100644 --- a/core/modules/node/lib/Drupal/node/NodeFormController.php +++ b/core/modules/node/lib/Drupal/node/NodeFormController.php @@ -279,6 +279,7 @@ protected function actions(array $form, array &$form_state) { } $element['preview'] = array( + '#type' => 'submit', '#access' => $preview_mode != DRUPAL_DISABLED && ($node->access('create') || $node->access('update')), '#value' => t('Preview'), '#weight' => 20, diff --git a/core/modules/responsive_image/lib/Drupal/responsive_image/ResponsiveImageMappingFormController.php b/core/modules/responsive_image/lib/Drupal/responsive_image/ResponsiveImageMappingFormController.php index 9b5e9c3..721817b 100644 --- a/core/modules/responsive_image/lib/Drupal/responsive_image/ResponsiveImageMappingFormController.php +++ b/core/modules/responsive_image/lib/Drupal/responsive_image/ResponsiveImageMappingFormController.php @@ -92,25 +92,6 @@ public function form(array $form, array &$form_state) { } /** - * Overrides Drupal\Core\Entity\EntityFormController::actions(). - */ - protected function actions(array $form, array &$form_state) { - // Only includes a Save action for the entity, no direct Delete button. - return array( - 'submit' => array( - '#value' => $this->t('Save'), - '#validate' => array( - array($this, 'validate'), - ), - '#submit' => array( - array($this, 'submit'), - array($this, 'save'), - ), - ), - ); - } - - /** * Overrides Drupal\Core\Entity\EntityFormController::validate(). */ public function validate(array $form, array &$form_state) { diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php index 66940a7..36a8e12 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityFormTest.php @@ -84,7 +84,9 @@ protected function assertFormCRUD($entity_type) { $this->assertTrue($entity, format_string('%entity_type: Modified entity found in the database.', array('%entity_type' => $entity_type))); $this->assertNotEqual($entity->name->value, $name1, format_string('%entity_type: The entity name has been modified.', array('%entity_type' => $entity_type))); - $this->drupalPostForm($entity_type . '/manage/' . $entity->id(), array(), t('Delete')); + $this->drupalGet($entity_type . '/manage/' . $entity->id()); + $this->clickLink(t('Delete')); + $this->drupalPostForm(NULL, array(), t('Confirm')); $entity = $this->loadEntityByName($entity_type, $name2); $this->assertFalse($entity, format_string('%entity_type: Entity not found in the database.', array('%entity_type' => $entity_type))); } diff --git a/core/modules/system/tests/modules/entity_test/entity_test.routing.yml b/core/modules/system/tests/modules/entity_test/entity_test.routing.yml index 55cc8bf..8b99660 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.routing.yml +++ b/core/modules/system/tests/modules/entity_test/entity_test.routing.yml @@ -5,6 +5,34 @@ entity_test.render: requirements: _access: 'TRUE' +entity_test.delete_entity_test: + path: '/entity_test/delete/entity_test/{entity_test}' + defaults: + _entity_form: entity_test.delete + requirements: + _access: 'TRUE' + +entity_test.delete_entity_test_mul: + path: '/entity_test/delete/entity_test_mul/{entity_test_mul}' + defaults: + _entity_form: entity_test_mul.delete + requirements: + _access: 'TRUE' + +entity_test.delete_entity_test_mulrev: + path: '/entity_test/delete/entity_test_mulrev/{entity_test_mulrev}' + defaults: + _entity_form: entity_test_mulrev.delete + requirements: + _access: 'TRUE' + +entity_test.delete_entity_test_rev: + path: '/entity_test/delete/entity_test_rev/{entity_test_rev}' + defaults: + _entity_form: entity_test_rev.delete + requirements: + _access: 'TRUE' + entity_test.render_options: path: '/entity_test_converter/{foo}' options: diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php index 653d27a..a2e4fed 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTest.php @@ -25,7 +25,8 @@ * "view_builder" = "Drupal\entity_test\EntityTestViewBuilder", * "access" = "Drupal\entity_test\EntityTestAccessController", * "form" = { - * "default" = "Drupal\entity_test\EntityTestFormController" + * "default" = "Drupal\entity_test\EntityTestFormController", + * "delete" = "Drupal\entity_test\EntityTestDeleteFormController" * }, * "translation" = "Drupal\content_translation\ContentTranslationHandler" * }, @@ -41,6 +42,7 @@ * links = { * "canonical" = "entity_test.render", * "edit-form" = "entity_test.edit_entity_test", + * "delete-form" = "entity_test.delete_entity_test", * "admin-form" = "entity_test.admin_entity_test" * } * ) diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php index c38e806..fa66806 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMul.php @@ -21,7 +21,8 @@ * "view_builder" = "Drupal\entity_test\EntityTestViewBuilder", * "access" = "Drupal\entity_test\EntityTestAccessController", * "form" = { - * "default" = "Drupal\entity_test\EntityTestFormController" + * "default" = "Drupal\entity_test\EntityTestFormController", + * "delete" = "Drupal\entity_test\EntityTestDeleteFormController" * }, * "translation" = "Drupal\content_translation\ContentTranslationHandler" * }, @@ -38,6 +39,7 @@ * links = { * "canonical" = "entity_test.edit_entity_test_mul", * "edit-form" = "entity_test.edit_entity_test_mul", + * "delete-form" = "entity_test.delete_entity_test_mul", * "admin-form" = "entity_test.admin_entity_test_mul" * } * ) diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php index 071ed67..a92b47f 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestMulRev.php @@ -20,7 +20,8 @@ * controllers = { * "access" = "Drupal\entity_test\EntityTestAccessController", * "form" = { - * "default" = "Drupal\entity_test\EntityTestFormController" + * "default" = "Drupal\entity_test\EntityTestFormController", + * "delete" = "Drupal\entity_test\EntityTestDeleteFormController" * }, * "translation" = "Drupal\content_translation\ContentTranslationHandler" * }, @@ -38,6 +39,7 @@ * }, * links = { * "canonical" = "entity_test.edit_entity_test_mulrev", + * "delete-form" = "entity_test.delete_entity_test_mulrev", * "edit-form" = "entity_test.edit_entity_test_mulrev" * } * ) diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php index 477e0b3..886f00a 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/Entity/EntityTestRev.php @@ -20,7 +20,8 @@ * controllers = { * "access" = "Drupal\entity_test\EntityTestAccessController", * "form" = { - * "default" = "Drupal\entity_test\EntityTestFormController" + * "default" = "Drupal\entity_test\EntityTestFormController", + * "delete" = "Drupal\entity_test\EntityTestDeleteFormController" * }, * "translation" = "Drupal\content_translation\ContentTranslationHandler" * }, @@ -36,6 +37,7 @@ * }, * links = { * "canonical" = "entity_test.edit_entity_test_rev", + * "delete-form" = "entity_test.delete_entity_test_rev", * "edit-form" = "entity_test.edit_entity_test_rev" * } * ) diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestDeleteFormController.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestDeleteFormController.php new file mode 100644 index 0000000..531cdb7 --- /dev/null +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestDeleteFormController.php @@ -0,0 +1,45 @@ + '', + ); + } + + /** + * {@inheritdoc} + */ + public function getQuestion() { + $entity_type = $this->entity->getEntityType(); + return t('Are you sure you want to delete the %label @entity-type?', array('%label' => $this->entity->label(), '@entity-type' => $entity_type->getLowercaseLabel())); + } + + /** + * {@inheritdoc} + */ + public function submit(array $form, array &$form_state) { + parent::submit($form, $form_state); + $entity = $this->entity; + $entity->delete(); + drupal_set_message(t('%entity_type @id has been deleted.', array('@id' => $entity->id(), '%entity_type' => $entity->getEntityTypeId()))); + $form_state['redirect_route']['route_name'] = ''; + } + +} diff --git a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php index 749ee44..4c0663d 100644 --- a/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php +++ b/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestFormController.php @@ -106,14 +106,4 @@ public function save(array $form, array &$form_state) { $form_state['rebuild'] = TRUE; } } - - /** - * Overrides Drupal\Core\Entity\EntityFormController::delete(). - */ - public function delete(array $form, array &$form_state) { - $entity = $this->entity; - $entity->delete(); - drupal_set_message(t('%entity_type @id has been deleted.', array('@id' => $entity->id(), '%entity_type' => $entity->getEntityTypeId()))); - $form_state['redirect_route']['route_name'] = ''; - } } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php index d07ab4a..d7b5374 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php @@ -202,11 +202,13 @@ function testNodeTermCreationAndDeletion() { } // Delete term 1 from the term edit page. - $this->drupalPostForm('taxonomy/term/' . $term_objects['term1']->id() . '/edit', array(), t('Delete')); + $this->drupalGet('taxonomy/term/' . $term_objects['term1']->id() . '/edit'); + $this->clickLink(t('Delete')); $this->drupalPostForm(NULL, NULL, t('Delete')); // Delete term 2 from the term delete page. - $this->drupalPostForm('taxonomy/term/' . $term_objects['term2']->id() . '/delete', array(), t('Delete')); + $this->drupalGet('taxonomy/term/' . $term_objects['term2']->id() . '/delete'); + $this->drupalPostForm(NULL, array(), t('Delete')); $term_names = array($term_objects['term3']->getName(), $term_objects['term4']->getName()); // Get the node. @@ -366,7 +368,8 @@ function testTermInterface() { $this->drupalGet('taxonomy/term/' . $term->id() . '/feed'); // Delete the term. - $this->drupalPostForm('taxonomy/term/' . $term->id() . '/edit', array(), t('Delete')); + $this->drupalGet('taxonomy/term/' . $term->id() . '/edit'); + $this->clickLink(t('Delete')); $this->drupalPostForm(NULL, NULL, t('Delete')); // Assert that the term no longer exists. diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php index 7e5fe4a..de7338f 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php @@ -140,8 +140,8 @@ function testTaxonomyAdminDeletingVocabulary() { $this->assertTrue($vocabulary, 'Vocabulary found.'); // Delete the vocabulary. - $edit = array(); - $this->drupalPostForm('admin/structure/taxonomy/manage/' . $vocabulary->id(), $edit, t('Delete')); + $this->drupalGet('admin/structure/taxonomy/manage/' . $vocabulary->id()); + $this->clickLink(t('Delete')); $this->assertRaw(t('Are you sure you want to delete the vocabulary %name?', array('%name' => $vocabulary->name)), '[confirm deletion] Asks for confirmation.'); $this->assertText(t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), '[confirm deletion] Inform that all terms will be deleted.'); diff --git a/core/modules/user/lib/Drupal/user/Tests/UserRoleAdminTest.php b/core/modules/user/lib/Drupal/user/Tests/UserRoleAdminTest.php index 5052571..0ddfa73 100644 --- a/core/modules/user/lib/Drupal/user/Tests/UserRoleAdminTest.php +++ b/core/modules/user/lib/Drupal/user/Tests/UserRoleAdminTest.php @@ -68,7 +68,8 @@ function testRoleAdministration() { $this->assertEqual($new_role->label(), $role_name, 'The role name has been successfully changed.'); // Test deleting a role. - $this->drupalPostForm("admin/people/roles/manage/{$role->id()}", array(), t('Delete')); + $this->drupalGet("admin/people/roles/manage/{$role->id()}"); + $this->clickLink(t('Delete')); $this->drupalPostForm(NULL, array(), t('Delete')); $this->assertRaw(t('Role %label has been deleted.', array('%label' => $role_name))); $this->assertNoLinkByHref("admin/people/roles/manage/{$role->id()}", 'Role edit link removed.'); diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewAddFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewAddFormController.php index 1f0b23b..b5daf5f 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewAddFormController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewAddFormController.php @@ -150,6 +150,7 @@ protected function actions(array $form, array &$form_state) { $actions['submit']['#value'] = $this->t('Save and edit'); $actions['cancel'] = array( + '#type' => 'submit', '#value' => $this->t('Cancel'), '#submit' => array( array($this, 'cancel'), diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewCloneFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewCloneFormController.php index f03eda4..faedd71 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewCloneFormController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewCloneFormController.php @@ -54,6 +54,7 @@ public function form(array $form, array &$form_state) { */ protected function actions(array $form, array &$form_state) { $actions['submit'] = array( + '#type' => 'submit', '#value' => $this->t('Clone'), '#submit' => array( array($this, 'submit'), diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php index c6a8aed..2436a48 100644 --- a/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php +++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewEditFormController.php @@ -223,6 +223,7 @@ protected function actions(array $form, array &$form_state) { unset($actions['delete']); $actions['cancel'] = array( + '#type' => 'submit', '#value' => $this->t('Cancel'), '#submit' => array( array($this, 'cancel'),