diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 6c8f04c..e07d02f 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -1718,7 +1718,7 @@ function theme_menu_local_task($variables) { $link_text = t('!local-task-title!active', array('!local-task-title' => $link['title'], '!active' => $active)); } if (!empty($link['href'])) { - // @todo - remove this onece all pages are converted to routes. + // @todo - remove this once all pages are converted to routes. $a_tag = l($link_text, $link['href'], $link['localized_options']); } else { diff --git a/core/lib/Drupal/Core/Menu/LocalTaskBase.php b/core/lib/Drupal/Core/Menu/LocalTaskBase.php index 6a09b56..d409d63 100644 --- a/core/lib/Drupal/Core/Menu/LocalTaskBase.php +++ b/core/lib/Drupal/Core/Menu/LocalTaskBase.php @@ -89,14 +89,27 @@ public function getRouteParameters(Request $request) { $parameters = isset($this->pluginDefinition['route_parameters']) ? $this->pluginDefinition['route_parameters'] : array(); $route = $this->routeProvider->getRouteByName($this->getRouteName()); $variables = $route->compile()->getVariables(); + // The _raw_variables hold the original path strings in positions - // corresponidng to slug sint eh path patterns. For example, if the route + // corresponding to slugs in the path patterns. For example, if the route // path pattern is /node/{node} and the requested path is /node/2 // then $request_raw_variables is array('node' => 2). - $request_raw_variables = $request->attributes->get('_raw_variables'); + + $raw_variables = $request->attributes->get('_raw_variables'); + foreach ($variables as $name) { - if (!isset($parameters[$name]) && $request_raw_variables->has($name)) { - $parameters[$name] = $request_raw_variables->get($name); + if (isset($parameters[$name])) { + continue; + } + + if ($raw_variables && $raw_variables->has($name)) { + $parameters[$name] = $raw_variables->get($name); + } + elseif ($request->attributes->has($name)) { + $parameters[$name] = $request->attributes->get($name); + } + else { + // @todo throw exception? } } return $parameters;