Commit 5259e3b9 authored by webchick's avatar webchick

Issue #2409209 by dawehner, xjm, mpdonadio, Wim Leers, hussainweb,...

Issue #2409209 by dawehner, xjm, mpdonadio, Wim Leers, hussainweb, RavindraSingh, prashantgoel: Replace all _url() calls beside the one in _l()
parent 1c38d70a
......@@ -11,6 +11,7 @@
use Drupal\Component\Utility\String;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\views\ExposedFormCache;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -115,7 +116,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#id' => drupal_html_id('edit-submit-' . $view->storage->id()),
);
$form['#action'] = _url($view->display_handler->getUrl());
$form['#action'] = $view->hasUrl() ? $view->getUrl()->toString() : Url::fromRoute('<current>')->toString();
$form['#theme'] = $view->buildThemeFunctions('views_exposed_form');
$form['#id'] = Html::cleanCssIdentifier('views_exposed_form-' . String::checkPlain($view->storage->id()) . '-' . String::checkPlain($display['id']));
......
......@@ -133,7 +133,8 @@ public function buildForm(array $form, FormStateInterface $form_state, ViewExecu
$query = $this->requestStack->getCurrentRequest()->query->all();
$query = UrlHelper::filterQueryParameters($query, array(), '');
$form['#action'] = $this->urlGenerator->generateFromPath($view->getUrl(), array('query' => $query));
$options = array('query' => $query);
$form['#action'] = $view->hasUrl() ? $view->getUrl()->setOptions($options)->toString() : Url::fromRoute('<current>')->setOptions($options)->toString();
// Tell the preprocessor whether it should hide the header, footer, pager...
$form['show_view_elements'] = array(
'#type' => 'value',
......
......@@ -723,11 +723,31 @@ public function getPath() {
}
}
/**
* {@inheritdoc}
*/
public function getRoutedDisplay() {
// If this display has a route, return this display.
if ($this instanceof DisplayRouterInterface) {
return $this;
}
// If the display does not have a route (e.g. a block display), get the
// route for the linked display.
$display_id = $this->getLinkDisplay();
if ($display_id && $this->view->displayHandlers->has($display_id) && is_object($this->view->displayHandlers->get($display_id))) {
return $this->view->displayHandlers->get($display_id)->getRoutedDisplay();
}
// No routed display exists, so return NULL
return NULL;
}
/**
* {@inheritdoc}
*/
public function getUrl() {
return $this->view->getUrl();
return $this->view->getUrl(NULL, $this->display['id']);
}
/**
......@@ -1973,27 +1993,31 @@ public function renderPager() {
*/
public function renderMoreLink() {
if ($this->isMoreEnabled() && ($this->useMoreAlways() || (!empty($this->view->pager) && $this->view->pager->hasMoreRecords()))) {
$path = $this->getPath();
// If the user has supplied a custom "More" link path, replace any
// argument tokens and use that for the URL.
if ($this->getOption('link_display') == 'custom_url' && $override_path = $this->getOption('link_url')) {
$tokens = $this->getArgumentsTokens();
$path = $this->viewsTokenReplace($override_path, $tokens);
$url = Url::fromUri('user-path:/' . $path);
}
// Otherwise, use the URL for the display.
else {
$url = $this->view->getUrl(NULL, $this->display['id']);
}
if ($path) {
if (empty($override_path)) {
$path = $this->view->getUrl(NULL, $path);
}
// If a URL is available (either from the display or a custom path),
// render the "More" link.
if ($url) {
$url_options = array();
if (!empty($this->view->exposed_raw_input)) {
$url_options['query'] = $this->view->exposed_raw_input;
}
$url->setOptions($url_options);
$theme = $this->view->buildThemeFunctions('views_more');
$path = check_url(_url($path, $url_options));
return array(
'#theme' => $theme,
'#more_url' => $path,
'#more_url' => $url->toString(),
'#link_text' => String::checkPlain($this->useMoreText()),
'#view' => $this->view,
);
......
......@@ -213,6 +213,23 @@ public function getLinkDisplay();
*/
public function getPath();
/**
* Points to the display which can be linked by this display.
*
* If the display has route information, the display itself is returned.
* Otherwise, the configured linked display is returned. For example, if a
* block display links to a page display, the page display will be returned
* in both cases.
*
* @return \Drupal\views\Plugin\views\display\DisplayRouterInterface|NULL
*/
public function getRoutedDisplay();
/**
* Returns a URL to $this display or its configured linked display.
*
* @return \Drupal\Core\Url|null
*/
public function getUrl();
/**
......
......@@ -46,4 +46,29 @@ public function alterRoutes(RouteCollection $collection);
*/
public function getUrlInfo();
/**
* Returns the route name for the display.
*
* The default route name for a display is views.$view_id.$display_id. Some
* displays may override existing routes; in these cases, the route that is
* overridden is returned instead.
*
* @return string
* The name of the route
*
* @see \Drupal\views\Plugin\views\display\DisplayRouterInterface::alterRoutes()
* @see \Drupal\views\Plugin\views\display\DisplayRouterInterface::getAlteredRouteNames()
*/
public function getRouteName();
/**
* Returns the list of routes overridden by Views.
*
* @return string[]
* An array of overridden route names. The keys are in the form
* view_id.display_id and the values are the route names.
*
* @see \Drupal\views\Plugin\views\display\DisplayRouterInterface::alterRoutes()
*/
public function getAlteredRouteNames();
}
......@@ -268,7 +268,7 @@ public function attachTo(ViewExecutable $clone, $display_id, array &$build) {
$clone->setDisplay($this->display['id']);
$clone->buildTitle();
if ($plugin = $clone->display_handler->getPlugin('style')) {
$plugin->attachTo($build, $display_id, $this->getPath(), $clone->getTitle());
$plugin->attachTo($build, $display_id, $clone->getUrl(), $clone->getTitle());
foreach ($clone->feedIcons as $feed_icon) {
$this->view->feedIcons[] = $feed_icon;
}
......
......@@ -294,8 +294,6 @@ public function getMenuLinks() {
}
}
$view_route_names = $this->state->get('views.view_route_names') ?: array();
$path = implode('/', $bits);
$view_id = $this->view->storage->id();
$display_id = $this->display['id'];
......@@ -309,7 +307,7 @@ public function getMenuLinks() {
// Some views might override existing paths, so we have to set the route
// name based upon the altering.
$links[$menu_link_id] = array(
'route_name' => isset($view_route_names[$view_id_display]) ? $view_route_names[$view_id_display] : "view.$view_id_display",
'route_name' => $this->getRouteName(),
// Identify URL embedded arguments and correlate them to a handler.
'load arguments' => array($this->view->storage->id(), $this->display['id'], '%index'),
'id' => $menu_link_id,
......@@ -490,11 +488,28 @@ public function validate() {
* {@inheritdoc}
*/
public function getUrlInfo() {
if (strpos($this->getOption('path'), '%') !== FALSE) {
throw new \InvalidArgumentException('No placeholders supported yet.');
}
return Url::fromRoute($this->getRouteName());
}
return Url::fromRoute($this->getRoute($this->view->storage->id(), $this->display['id']));
/**
* {@inheritdoc}
*/
public function getRouteName() {
$view_id = $this->view->storage->id();
$display_id = $this->display['id'];
$view_route_key = "$view_id.$display_id";
// Check for overridden route names.
$view_route_names = $this->getAlteredRouteNames();
return (isset($view_route_names[$view_route_key]) ? $view_route_names[$view_route_key] : "views.$view_route_key");
}
/**
* {@inheritdoc}
*/
public function getAlteredRouteNames() {
return $this->state->get('views.view_route_names') ?: array();
}
}
......@@ -8,6 +8,7 @@
namespace Drupal\views\Plugin\views\row;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
* Renders an RSS item based on fields.
......@@ -143,7 +144,7 @@ public function render($row) {
// Create the RSS item object.
$item = new \stdClass();
$item->title = $this->getField($row_index, $this->options['title_field']);
$item->link = _url($this->getField($row_index, $this->options['link_field']), array('absolute' => TRUE));
$item->link = Url::fromUri('user-path:/' . $this->getField($row_index, $this->options['link_field']))->setAbsolute()->toString();
$item->description = $this->getField($row_index, $this->options['description_field']);
$item->elements = array(
array('key' => 'pubDate', 'value' => $this->getField($row_index, $this->options['date_field'])),
......@@ -157,7 +158,7 @@ public function render($row) {
$item_guid = $this->getField($row_index, $this->options['guid_field_options']['guid_field']);
if ($this->options['guid_field_options']['guid_field_is_permalink']) {
$guid_is_permalink_string = 'true';
$item_guid = _url($item_guid, array('absolute' => TRUE));
$item_guid = Url::fromUri('user-path:/' . $item_guid)->setAbsolute()->toString();
}
$item->elements[] = array(
'key' => 'guid',
......
......@@ -7,6 +7,8 @@
namespace Drupal\views\Plugin\views\style;
use Drupal\Core\Url;
/**
* Default style plugin to render an OPML feed.
*
......@@ -32,7 +34,7 @@ class Opml extends StylePluginBase {
/**
* {@inheritdoc}
*/
public function attachTo(array &$build, $display_id, $path, $title) {
public function attachTo(array &$build, $display_id, Url $feed_url, $title) {
$display = $this->view->displayHandlers->get($display_id);
$url_options = array();
$input = $this->view->getExposedInput();
......@@ -41,7 +43,7 @@ public function attachTo(array &$build, $display_id, $path, $title) {
}
$url_options['absolute'] = TRUE;
$url = _url($this->view->getUrl(NULL, $path), $url_options);
$url = $feed_url->setOptions($url_options)->toString();
if ($display->hasPath()) {
if (empty($this->preview)) {
$build['#attached']['feed'][] = array($url, $title);
......
......@@ -9,6 +9,7 @@
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
/**
* Default style plugin to render an RSS feed.
......@@ -32,7 +33,7 @@ class Rss extends StylePluginBase {
*/
protected $usesRowPlugin = TRUE;
public function attachTo(array &$build, $display_id, $path, $title) {
public function attachTo(array &$build, $display_id, Url $feed_url, $title) {
$url_options = array();
$input = $this->view->getExposedInput();
if ($input) {
......@@ -40,7 +41,7 @@ public function attachTo(array &$build, $display_id, $path, $title) {
}
$url_options['absolute'] = TRUE;
$url = _url($this->view->getUrl(NULL, $path), $url_options);
$url = $feed_url->setOptions($url_options)->toString();
// Add the RSS icon to the view.
$this->view->feedIcons[] = [
......
......@@ -76,6 +76,8 @@ public function testEqualGroupedExposed() {
$filters['name']['group_info']['default_group'] = 1;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
$resultset = array(
......@@ -129,6 +131,8 @@ public function testEqualGroupedNotExposed() {
$filters['name']['group_info']['default_group'] = 2;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
$resultset = array(
......@@ -153,6 +157,7 @@ protected function getGroupedExposedFilters() {
$filters = array(
'name' => array(
'id' => 'name',
'plugin_id' => 'equality',
'table' => 'views_test_data',
'field' => 'name',
'relationship' => 'none',
......
......@@ -80,6 +80,8 @@ public function testFilterNumericExposedGroupedSimple() {
$filters['age']['group_info']['default_group'] = 1;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
$resultset = array(
......@@ -173,6 +175,8 @@ public function testFilterNumericExposedGroupedBetween() {
$filters['age']['group_info']['default_group'] = 2;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
$resultset = array(
......@@ -201,6 +205,8 @@ public function testFilterNumericExposedGroupedNotBetween() {
$filters['age']['group_info']['default_group'] = 3;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
$resultset = array(
......@@ -289,6 +295,8 @@ public function testFilterNumericExposedGroupedEmpty() {
$filters['age']['group_info']['default_group'] = 4;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
$resultset = array(
......@@ -305,6 +313,8 @@ public function testFilterNumericExposedGroupedNotEmpty() {
$filters['age']['group_info']['default_group'] = 5;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
$resultset = array(
......@@ -366,6 +376,7 @@ protected function getGroupedExposedFilters() {
$filters = array(
'age' => array(
'id' => 'age',
'plugin_id' => 'numeric',
'table' => 'views_test_data',
'field' => 'age',
'relationship' => 'none',
......
......@@ -120,6 +120,8 @@ function testFilterStringGroupedExposedEqual() {
$filters['name']['group_info']['default_group'] = 1;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
......@@ -175,6 +177,8 @@ function testFilterStringGroupedExposedNotEqual() {
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
......@@ -230,6 +234,8 @@ function testFilterStringGroupedExposedContains() {
$filters['name']['group_info']['default_group'] = '3';
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
......@@ -304,6 +310,8 @@ function testFilterStringGroupedExposedWord() {
$filters['name']['group_info']['default_group'] = '3';
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
......@@ -369,6 +377,8 @@ function testFilterStringGroupedExposedStarts() {
$filters['description']['group_info']['default_group'] = 2;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
......@@ -420,6 +430,8 @@ function testFilterStringGroupedExposedNotStarts() {
$filters['description']['group_info']['default_group'] = 3;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
......@@ -474,6 +486,8 @@ function testFilterStringGroupedExposedEnds() {
$filters['description']['group_info']['default_group'] = 4;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
......@@ -525,6 +539,8 @@ function testFilterStringGroupedExposedNotEnds() {
$filters['description']['group_info']['default_group'] = 5;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
......@@ -578,6 +594,8 @@ function testFilterStringGroupedExposedNot() {
$filters['description']['group_info']['default_group'] = 6;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
......@@ -630,6 +648,8 @@ function testFilterStringGroupedExposedShorter() {
$filters['name']['group_info']['default_group'] = 4;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
$resultset = array(
......@@ -676,6 +696,8 @@ function testFilterStringGroupedExposedLonger() {
$filters['name']['group_info']['default_group'] = 5;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
$resultset = array(
......@@ -719,6 +741,8 @@ function testFilterStringGroupedExposedEmpty() {
$filters['description']['group_info']['default_group'] = 7;
$view->setDisplay('page_1');
$view->displayHandlers->get('page_1')->overrideOption('filters', $filters);
$view->save();
$this->container->get('router.builder')->rebuild();
$this->executeView($view);
$resultset = array(
......@@ -733,6 +757,7 @@ protected function getGroupedExposedFilters() {
$filters = array(
'name' => array(
'id' => 'name',
'plugin_id' => 'string',
'table' => 'views_test_data',
'field' => 'name',
'relationship' => 'none',
......@@ -778,6 +803,7 @@ protected function getGroupedExposedFilters() {
),
'description' => array(
'id' => 'description',
'plugin_id' => 'string',
'table' => 'views_test_data',
'field' => 'description',
'relationship' => 'none',
......
......@@ -28,6 +28,7 @@ class TokenReplaceTest extends ViewUnitTestBase {
protected function setUp() {
parent::setUp();
$this->installSchema('system', 'url_alias');
$this->container->get('router.builder')->rebuild();
}
/**
......@@ -44,7 +45,7 @@ function testTokenReplacement() {
'[view:description]' => 'Test view to token replacement tests.',
'[view:id]' => 'test_tokens',
'[view:title]' => 'Test token page',
'[view:url]' => $view->getUrlInfo('page_1')->setAbsolute(TRUE)->toString(),
'[view:url]' => $view->getUrl(NULL, 'page_1')->setAbsolute(TRUE)->toString(),
'[view:total-rows]' => (string) $view->total_rows,
'[view:base-table]' => 'views_test_data',
'[view:base-field]' => 'id',
......
......@@ -322,18 +322,6 @@ public function testPropertyMethods() {
$view->override_path = $override_path;
$this->assertEqual($view->getPath(), $override_path);
// Test the getUrl method().
$url = 'foo';
$this->assertEqual($view->getUrl(NULL, $url), $url);
// Test with arguments.
$arg1 = 'bar';
$arg2 = 12345;
$this->assertEqual($view->getUrl(array($arg1, $arg2), $url), "$url/$arg1/$arg2");
// Test the override_url property override.
$override_url = 'baz';
$view->override_url = $override_url;
$this->assertEqual($view->getUrl(NULL, $url), $override_url);
// Test the title methods.
$title = $this->randomString();
$view->setTitle($title);
......
......@@ -10,7 +10,9 @@
use Drupal\Component\Utility\String;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\Form\FormState;
use Drupal\Core\Routing\RouteProviderInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Url;
use Drupal\views\Plugin\views\display\DisplayRouterInterface;
use Drupal\views\Plugin\views\query\QueryPluginBase;
use Drupal\views\ViewEntityInterface;
......@@ -239,9 +241,9 @@ class ViewExecutable {
/**
* Allow to override the url of the current view.
*
* @var string
* @var \Drupal\Core\Url
*/
public $override_url = NULL;
public $override_url;
/**
* Allow to override the path used for generated urls.
......@@ -425,6 +427,13 @@ class ViewExecutable {
*/
protected $viewsData;
/**
* The route provider.
*
* @var \Drupal\Core\Routing\RouteProviderInterface
*/
protected $routeProvider;
/**
* Constructs a new ViewExecutable object.
*
......@@ -434,13 +443,16 @@ class ViewExecutable {
* The current user.
* @param \Drupal\views\ViewsData $views_data
* The views data.
* @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
* The route provider.
*/
public function __construct(ViewEntityInterface $storage, AccountInterface $user, ViewsData $views_data) {
public function __construct(ViewEntityInterface $storage, AccountInterface $user, ViewsData $views_data, RouteProviderInterface $route_provider) {
// Reference the storage and the executable to each other.
$this->storage = $storage;
$this->storage->set('executable', $this);
$this->user = $user;
$this->viewsData = $views_data;
$this->routeProvider = $route_provider;
// Add the default css for a view.
$this->element['#attached']['library'][] = 'views/views.module';
......@@ -1692,12 +1704,47 @@ public function buildTitle() {
$this->_buildArguments();
}
/**
* Determines whether you can link to the view or a particular display.
*
* Some displays (e.g. block displays) do not have their own route, but may
* optionally provide a link to another display that does have a route.
*
* @param array $args
* (optional) The arguments.
* @param string $display_id
* (optional) The display ID. The current display will be used by default.
*
* @return bool
*/
public function hasUrl($args = NULL, $display_id = NULL) {
if (!empty($this->override_url)) {
return TRUE;
}
// If the display has a valid route available (either its own or for a
// linked display), then we can provide a URL for it.
$display_handler = $this->displayHandlers->get($display_id ?: $this->current_display)->getRoutedDisplay();
if (!$display_handler instanceof DisplayRouterInterface) {
return FALSE;
}
return TRUE;
}
/**
* Get the URL for the current view.
*
* This URL will be adjusted for arguments.
*
* @param array $args
* (optional) Passed in arguments.
* @param string $display_id
* (optional) Specify the display ID to link to, fallback to the current ID.
*
* @return \Drupal\Core\Url
*/
public function getUrl($args = NULL, $path = NULL) {
public function getUrl($args = NULL, $display_id = NULL) {
if (!empty($this->override_url)) {
return $this->override_url;
}
......@@ -1705,6 +1752,12 @@ public function getUrl($args = NULL, $path = NULL) {
if (!isset($path)) {
$path = $this->getPath();
}
$display_handler = $this->displayHandlers->get($display_id ?: $this->current_display)->getRoutedDisplay();
if (!$display_handler instanceof DisplayRouterInterface) {
throw new \InvalidArgumentException('You cannot create a URL to a display without routes.');
}
if (!isset($args)) {
$args = $this->args;
......@@ -1721,41 +1774,41 @@ public function getUrl($args = NULL, $path = NULL) {
}
// Don't bother working if there's nothing to do:
if (empty($path) || (empty($args) && strpos($path, '%') === FALSE)) {
return $path;
return $display_handler->getUrlInfo();
}
$pieces = array();
$argument_keys = isset($this->argument) ? array_keys($this->argument) : array();
$id = current($argument_keys);
foreach (explode('/', $path) as $piece) {
if ($piece != '%') {
$pieces[] = $piece;
}
else {
if (empty($args)) {
// Try to never put % in a url; use the wildcard instead.
if ($id && !empty($this->argument[$id]->options['exception']['value'])) {
$pieces[] = $this->argument[$id]->options['exception']['value'];
}
else {
$pieces[] = '*'; // gotta put something if there just isn't one.
}
/** @var \Drupal\Core\Url $url */
$url = $display_handler->getUrlInfo();
$route = $this->routeProvider->getRouteByName($url->getRouteName());
$variables = $route->compile()->getVariables();
$parameters = $url->getRouteParameters();
foreach ($variables as $variable_name) {
if (empty($args)) {
// Try to never put % in a URL; use the wildcard instead.
if ($id && !empty($this->argument[$id]->options['exception']['value'])) {
$parameters[$variable_name] = $this->argument[$id]->options['exception']['value'];
}
else {
$pieces[] = array_shift($args);
// Provide some fallback in case no exception value could be found.
$parameters[$variable_name] = '*';
}
}
else {
$parameters[$variable_name] = array_shift($args);
}
if ($id) {
$id = next($argument_keys);
}
if ($id) {