Issue #2354177 by yched: Shortcut::getRouteParams() should be named getRouteParameters() for consistency.

8.0.x
Alex Pott 2014-10-12 22:32:29 +01:00
parent c8f9c9b41e
commit 51c1012484
4 changed files with 9 additions and 9 deletions

View File

@ -258,7 +258,7 @@ function shortcut_renderable_links($shortcut_set = NULL) {
$shortcut = \Drupal::entityManager()->getTranslationFromContext($shortcut);
$links[] = array(
'title' => $shortcut->label(),
'url' => Url::fromRoute($shortcut->getRouteName(), $shortcut->getRouteParams()),
'url' => Url::fromRoute($shortcut->getRouteName(), $shortcut->getRouteParameters()),
);
$cache_tags = Cache::mergeTags($cache_tags, $shortcut->getCacheTag());
}
@ -314,7 +314,7 @@ function shortcut_preprocess_page(&$variables) {
// Check if $link is already a shortcut and set $link_mode accordingly.
$shortcuts = \Drupal::entityManager()->getStorage('shortcut')->loadByProperties(array('shortcut_set' => $shortcut_set->id()));
foreach ($shortcuts as $shortcut) {
if ($shortcut->getRouteName() == $url->getRouteName() && $shortcut->getRouteParams() == $url->getRouteParameters()) {
if ($shortcut->getRouteName() == $url->getRouteName() && $shortcut->getRouteParameters() == $url->getRouteParameters()) {
$shortcut_id = $shortcut->id();
break;
}

View File

@ -86,7 +86,7 @@ class Shortcut extends ContentEntityBase implements ShortcutInterface {
* {@inheritdoc}
*/
public function getUrl() {
return new Url($this->getRouteName(), $this->getRouteParams());
return new Url($this->getRouteName(), $this->getRouteParameters());
}
/**
@ -107,14 +107,14 @@ class Shortcut extends ContentEntityBase implements ShortcutInterface {
/**
* {@inheritdoc}
*/
public function getRouteParams() {
public function getRouteParameters() {
return $this->get('route_parameters')->first()->getValue();
}
/**
* {@inheritdoc}
*/
public function setRouteParams($route_parameters) {
public function setRouteParameters($route_parameters) {
$this->set('route_parameters', $route_parameters);
return $this;
}
@ -146,7 +146,7 @@ class Shortcut extends ContentEntityBase implements ShortcutInterface {
$url = Url::createFromRequest(Request::create("/{$this->path->value}"));
}
$this->setRouteName($url->getRouteName());
$this->setRouteParams($url->getRouteParameters());
$this->setRouteParameters($url->getRouteParameters());
}
/**

View File

@ -85,7 +85,7 @@ interface ShortcutInterface extends ContentEntityInterface {
* @return array
* The route parameters of this shortcut.
*/
public function getRouteParams();
public function getRouteParameters();
/**
* Sets the route parameters associated with this shortcut.
@ -96,6 +96,6 @@ interface ShortcutInterface extends ContentEntityInterface {
* @return \Drupal\shortcut\ShortcutInterface
* The called shortcut entity.
*/
public function setRouteParams($route_parameters);
public function setRouteParameters($route_parameters);
}

View File

@ -25,7 +25,7 @@ class ShortcutPathValue extends TypedData {
$entity = $this->parent->getEntity();
if ($route_name = $entity->getRouteName()) {
$path = \Drupal::urlGenerator()->getPathFromRoute($route_name, $entity->getRouteParams());
$path = \Drupal::urlGenerator()->getPathFromRoute($route_name, $entity->getRouteParameters());
$this->value = trim($path, '/');
}
else {