diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 94d0e57..4c2a367 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -985,7 +985,10 @@ function menu_item_route_access(Route $route, $href, &$map) { if (isset($path_bits[$index]) && preg_match('/{(?.*)}/', $path_bits[$index], $matches)) { // If that placeholder is present on the request attributes, replace the // placeholder in the map with the value. - if ($request->attributes->has($matches['placeholder'])) { + if ($request->attributes->get('converted')->has($matches['placeholder'])) { + $map[$index] = $request->attributes->get('converted')->get($matches['placeholder']); + } + elseif ($request->attributes->has($matches['placeholder'])) { $map[$index] = $request->attributes->get($matches['placeholder']); } } diff --git a/core/lib/Drupal/Core/Entity/EntityAccessCheck.php b/core/lib/Drupal/Core/Entity/EntityAccessCheck.php index eb5766c..7b91561 100644 --- a/core/lib/Drupal/Core/Entity/EntityAccessCheck.php +++ b/core/lib/Drupal/Core/Entity/EntityAccessCheck.php @@ -42,8 +42,8 @@ public function access(Route $route, Request $request) { $requirement = $route->getRequirement('_entity_access'); list($entity_type, $operation) = explode('.', $requirement); // If there is valid entity of the given entity type, check its access. - if ($request->attributes->has('_converted_' . $entity_type)) { - $entity = $request->attributes->get('_converted_' . $entity_type); + if ($request->attributes->get('converted')->has($entity_type)) { + $entity = $request->attributes->get('converted')->get($entity_type); if ($entity instanceof EntityInterface) { return $entity->access($operation); } diff --git a/core/lib/Drupal/Core/Entity/HtmlEntityFormController.php b/core/lib/Drupal/Core/Entity/HtmlEntityFormController.php index b79fd90..be28296 100644 --- a/core/lib/Drupal/Core/Entity/HtmlEntityFormController.php +++ b/core/lib/Drupal/Core/Entity/HtmlEntityFormController.php @@ -52,8 +52,8 @@ protected function getFormObject(Request $request, $form_arg) { $form_arg .= '.default'; list ($entity_type, $operation) = explode('.', $form_arg); - if ($request->attributes->has('_converted_' . $entity_type)) { - $entity = $request->attributes->get('_converted_' . $entity_type); + if ($request->attributes->get('converted')->has($entity_type)) { + $entity = $request->attributes->get('converted')->get($entity_type); } else { $entity = $manager->getStorageController($entity_type)->create(array()); diff --git a/core/modules/edit/lib/Drupal/edit/Access/EditEntityAccessCheck.php b/core/modules/edit/lib/Drupal/edit/Access/EditEntityAccessCheck.php index 9dfbfd1..96e1023 100644 --- a/core/modules/edit/lib/Drupal/edit/Access/EditEntityAccessCheck.php +++ b/core/modules/edit/lib/Drupal/edit/Access/EditEntityAccessCheck.php @@ -35,7 +35,7 @@ public function access(Route $route, Request $request) { // http://drupal.org/node/1798214. $this->validateAndUpcastRequestAttributes($request); - return $this->accessEditEntity($request->attributes->get('entity')); + return $this->accessEditEntity($request->attributes->get('converted')->get('entity')); } /** @@ -50,8 +50,8 @@ public function accessEditEntity(EntityInterface $entity) { */ protected function validateAndUpcastRequestAttributes(Request $request) { // Load the entity. - if (!is_object($entity = $request->attributes->get('entity'))) { - $entity_id = $entity; + if (!$request->attributes->get('converted')->get('entity')) { + $entity_id = $request->attributes->get('entity'); $entity_type = $request->attributes->get('entity_type'); if (!$entity_type || !entity_get_info($entity_type)) { throw new NotFoundHttpException(); @@ -60,7 +60,7 @@ protected function validateAndUpcastRequestAttributes(Request $request) { if (!$entity) { throw new NotFoundHttpException(); } - $request->attributes->set('entity', $entity); + $request->attributes->get('converted')->set('entity', $entity); } } diff --git a/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php b/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php index 01511cb..18f5b25 100644 --- a/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php +++ b/core/modules/edit/lib/Drupal/edit/Access/EditEntityFieldAccessCheck.php @@ -35,7 +35,7 @@ public function access(Route $route, Request $request) { // http://drupal.org/node/1798214. $this->validateAndUpcastRequestAttributes($request); - return $this->accessEditEntityField($request->attributes->get('entity'), $request->attributes->get('field_name')); + return $this->accessEditEntityField($request->attributes->get('converted')->get('entity'), $request->attributes->get('field_name')); } /** @@ -50,8 +50,8 @@ public function accessEditEntityField(EntityInterface $entity, $field_name) { */ protected function validateAndUpcastRequestAttributes(Request $request) { // Load the entity. - if (!is_object($entity = $request->attributes->get('_converted_entity'))) { - $entity_id = $entity; + if (!$request->attributes->get('converted')->get('entity')) { + $entity_id = $request->attributes->get('entity'); $entity_type = $request->attributes->get('entity_type'); if (!$entity_type || !entity_get_info($entity_type)) { throw new NotFoundHttpException(); @@ -60,8 +60,7 @@ protected function validateAndUpcastRequestAttributes(Request $request) { if (!$entity) { throw new NotFoundHttpException(); } - // @todo Why does the field access check converts the parameters. - $request->attributes->set('_converted_entity', $entity); + $request->attributes->get('converted')->set('entity', $entity); } // Validate the field name and language. diff --git a/core/modules/filter/lib/Drupal/filter/Access/FilterAccessCheck.php b/core/modules/filter/lib/Drupal/filter/Access/FilterAccessCheck.php index 20c6912..c447147 100644 --- a/core/modules/filter/lib/Drupal/filter/Access/FilterAccessCheck.php +++ b/core/modules/filter/lib/Drupal/filter/Access/FilterAccessCheck.php @@ -27,7 +27,7 @@ public function applies(Route $route) { * {@inheritdoc} */ public function access(Route $route, Request $request) { - if ($format = $request->attributes->get('_converted_filter_format')) { + if ($format = $request->attributes->get('converted')->get('filter_format')) { // Handle special cases up front. All users have access to the fallback // format. if ($format->format == filter_fallback_format()) { diff --git a/core/modules/filter/lib/Drupal/filter/Access/FormatDisableCheck.php b/core/modules/filter/lib/Drupal/filter/Access/FormatDisableCheck.php index beeaf6f..eab9db2 100644 --- a/core/modules/filter/lib/Drupal/filter/Access/FormatDisableCheck.php +++ b/core/modules/filter/lib/Drupal/filter/Access/FormatDisableCheck.php @@ -27,7 +27,7 @@ public function applies(Route $route) { * Implements \Drupal\Core\Access\AccessCheckInterface::access(). */ public function access(Route $route, Request $request) { - if ($format = $request->attributes->get('_converted_filter_format')) { + if ($format = $request->attributes->get('converted')->get('filter_format')) { return user_access('administer filters') && ($format->format != filter_fallback_format()); } diff --git a/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php b/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php index c1cc60d..4df0d40 100644 --- a/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php +++ b/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php @@ -27,7 +27,7 @@ public function applies(Route $route) { * {@inheritdoc} */ public function access(Route $route, Request $request) { - if (user_access('administer menu') && $menu_link = $request->attributes->get('_converted_menu_link')) { + if (user_access('administer menu') && $menu_link = $request->attributes->get('converted')->get('menu_link')) { // Links defined via hook_menu may not be deleted. Updated items are an // exception, as they can be broken. return $menu_link->module !== 'system' || $menu_link->updated; diff --git a/core/modules/menu/lib/Drupal/menu/Access/DeleteMenuAccessCheck.php b/core/modules/menu/lib/Drupal/menu/Access/DeleteMenuAccessCheck.php index 72ebe4d..42c3f6a 100644 --- a/core/modules/menu/lib/Drupal/menu/Access/DeleteMenuAccessCheck.php +++ b/core/modules/menu/lib/Drupal/menu/Access/DeleteMenuAccessCheck.php @@ -27,7 +27,7 @@ public function applies(Route $route) { * {@inheritdoc} */ public function access(Route $route, Request $request) { - if (user_access('administer menu') && $menu = $request->attributes->get('_converted_menu')) { + if (user_access('administer menu') && $menu = $request->attributes->get('converted')->get('menu')) { // System-defined menus may not be deleted. $system_menus = menu_list_system_menus(); return !isset($system_menus[$menu->id()]);