--- convert-entity_get_form-to-routing-1987692-12.patch 2013-05-21 19:34:13.000000000 +1000 +++ convert-entity_get_form-to-routing-1987692-15.patch 2013-05-23 16:34:08.000000000 +1000 @@ -1,8 +1,8 @@ diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module -index bd65f4f..d50f2c6 100644 +index bd65f4f..470080d 100644 --- a/core/modules/aggregator/aggregator.module +++ b/core/modules/aggregator/aggregator.module -@@ -214,19 +214,13 @@ function aggregator_menu() { +@@ -214,19 +214,17 @@ function aggregator_menu() { ); $items['aggregator/sources/%aggregator_feed/configure'] = array( 'title' => 'Configure', @@ -11,7 +11,8 @@ - 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, 'weight' => 10, -- 'file' => 'aggregator.admin.inc', ++ // @todo: Remove the file entry when http://drupal.org/node/1946456 is in. + 'file' => 'aggregator.admin.inc', + 'route_name' => 'aggregator_feed_configure', ); $items['admin/config/services/aggregator/edit/feed/%aggregator_feed'] = array( @@ -19,7 +20,8 @@ - 'page callback' => 'entity_get_form', - 'page arguments' => array(6), - 'access arguments' => array('administer news feeds'), -- 'file' => 'aggregator.admin.inc', ++ // @todo: Remove the file entry when http://drupal.org/node/1946456 is in. + 'file' => 'aggregator.admin.inc', + 'route_name' => 'aggregator_feed_edit', ); $items['admin/config/services/aggregator/delete/feed/%aggregator_feed'] = array( @@ -79,6 +81,35 @@ + _entity_form: 'menu_link.default' + requirements: + _permission: 'administer menu' +diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php +index 96e8697..bf1095e 100644 +--- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php ++++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php +@@ -20,6 +20,9 @@ class VocabularyFormController extends EntityFormController { + public function form(array $form, array &$form_state) { + $vocabulary = $this->entity; + ++ // @todo: Remove the file entry when http://drupal.org/node/1946456 is in. ++ module_load_include('inc', 'taxonomy', 'taxonomy.admin'); ++ + // Check whether we need a deletion confirmation form. + if (isset($form_state['confirm_delete']) && isset($form_state['values']['vid'])) { + return taxonomy_vocabulary_confirm_delete($form, $form_state, $form_state['values']['vid']); +diff --git a/core/modules/taxonomy/taxonomy.admin.inc b/core/modules/taxonomy/taxonomy.admin.inc +index 0703071..d45b2b5 100644 +--- a/core/modules/taxonomy/taxonomy.admin.inc ++++ b/core/modules/taxonomy/taxonomy.admin.inc +@@ -537,6 +537,10 @@ function taxonomy_vocabulary_confirm_delete($form, &$form_state, $vid) { + $form['vid'] = array('#type' => 'value', '#value' => $vid); + + $form_state['taxonomy']['vocabulary'] = $vocabulary; ++ ++ // @todo: Remove the file entry when http://drupal.org/node/1946456 is in. ++ $form_state['build_info']['files'][] = array('type' => 'inc', 'module' => 'taxonomy', 'name' => 'taxonomy.admin'); ++ + $form['#id'] = 'taxonomy_vocabulary_confirm_delete'; + $form['type'] = array('#type' => 'value', '#value' => 'vocabulary'); + $form['name'] = array('#type' => 'value', '#value' => $vocabulary->name); diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 2557008..4f7fc6e 100644 --- a/core/modules/taxonomy/taxonomy.module @@ -134,8 +165,42 @@ + _entity_form: 'taxonomy_vocabulary.default' + requirements: + _entity_access: 'taxonomy_vocabulary.update' +diff --git a/core/modules/user/lib/Drupal/user/ProfileFormController.php b/core/modules/user/lib/Drupal/user/ProfileFormController.php +index 484a4af..0d2ac9e 100644 +--- a/core/modules/user/lib/Drupal/user/ProfileFormController.php ++++ b/core/modules/user/lib/Drupal/user/ProfileFormController.php +@@ -21,13 +21,28 @@ protected function actions(array $form, array &$form_state) { + + $element['delete']['#type'] = 'submit'; + $element['delete']['#value'] = t('Cancel account'); +- $element['delete']['#submit'] = array('user_edit_cancel_submit'); ++ $element['delete']['#submit'] = array(array($this, 'editCancelSubmit')); + $element['delete']['#access'] = $account->uid > 1 && (($account->uid == $GLOBALS['user']->uid && user_access('cancel account')) || user_access('administer users')); + + return $element; + } + + /** ++ * Submit function for the 'Cancel account' button on the user edit form. ++ */ ++ public function editCancelSubmit($form, &$form_state) { ++ $destination = array(); ++ if (isset($_GET['destination'])) { ++ $destination = drupal_get_destination(); ++ unset($_GET['destination']); ++ } ++ // Note: We redirect from user/uid/edit to user/uid/cancel ++ // to make the tabs disappear. ++ $account = $form_state['controller']->getEntity(); ++ $form_state['redirect'] = array("user/" . $account->uid . "/cancel", array('query' => $destination)); ++ } ++ ++ /** + * Overrides Drupal\Core\Entity\EntityFormController::submit(). + */ + public function submit(array $form, array &$form_state) { diff --git a/core/modules/user/user.module b/core/modules/user/user.module -index 322311f..4bec587 100644 +index 42a79db..3d58f79 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1029,12 +1029,8 @@ function user_menu() { @@ -152,6 +217,36 @@ ); return $items; } +diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc +index 5f0cfab..8161f33 100644 +--- a/core/modules/user/user.pages.inc ++++ b/core/modules/user/user.pages.inc +@@ -199,24 +199,10 @@ function template_preprocess_user(&$variables) { + } + + /** +- * Submit function for the 'Cancel account' button on the user edit form. +- */ +-function user_edit_cancel_submit($form, &$form_state) { +- $destination = array(); +- if (isset($_GET['destination'])) { +- $destination = drupal_get_destination(); +- unset($_GET['destination']); +- } +- // Note: We redirect from user/uid/edit to user/uid/cancel to make the tabs disappear. +- $account = $form_state['controller']->getEntity(); +- $form_state['redirect'] = array("user/" . $account->uid . "/cancel", array('query' => $destination)); +-} +- +-/** + * Form builder; confirm form for cancelling user account. + * + * @ingroup forms +- * @see user_edit_cancel_submit() ++ * @see ProfileFormController::editCancelSubmit() + */ + function user_cancel_confirm_form($form, &$form_state, $account) { + global $user; diff --git a/core/modules/user/user.routing.yml b/core/modules/user/user.routing.yml index 409b033..b82644a 100644 --- a/core/modules/user/user.routing.yml