Skip to content
Snippets Groups Projects
Commit 51c10124 authored by Alex Pott's avatar Alex Pott
Browse files

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

Issue #2354177 by yched: Shortcut::getRouteParams() should be named getRouteParameters() for consistency.
parent c8f9c9b4
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -258,7 +258,7 @@ function shortcut_renderable_links($shortcut_set = NULL) { ...@@ -258,7 +258,7 @@ function shortcut_renderable_links($shortcut_set = NULL) {
$shortcut = \Drupal::entityManager()->getTranslationFromContext($shortcut); $shortcut = \Drupal::entityManager()->getTranslationFromContext($shortcut);
$links[] = array( $links[] = array(
'title' => $shortcut->label(), '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()); $cache_tags = Cache::mergeTags($cache_tags, $shortcut->getCacheTag());
} }
...@@ -314,7 +314,7 @@ function shortcut_preprocess_page(&$variables) { ...@@ -314,7 +314,7 @@ function shortcut_preprocess_page(&$variables) {
// Check if $link is already a shortcut and set $link_mode accordingly. // Check if $link is already a shortcut and set $link_mode accordingly.
$shortcuts = \Drupal::entityManager()->getStorage('shortcut')->loadByProperties(array('shortcut_set' => $shortcut_set->id())); $shortcuts = \Drupal::entityManager()->getStorage('shortcut')->loadByProperties(array('shortcut_set' => $shortcut_set->id()));
foreach ($shortcuts as $shortcut) { 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(); $shortcut_id = $shortcut->id();
break; break;
} }
......
...@@ -86,7 +86,7 @@ public function setWeight($weight) { ...@@ -86,7 +86,7 @@ public function setWeight($weight) {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getUrl() { public function getUrl() {
return new Url($this->getRouteName(), $this->getRouteParams()); return new Url($this->getRouteName(), $this->getRouteParameters());
} }
/** /**
...@@ -107,14 +107,14 @@ public function setRouteName($route_name) { ...@@ -107,14 +107,14 @@ public function setRouteName($route_name) {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getRouteParams() { public function getRouteParameters() {
return $this->get('route_parameters')->first()->getValue(); return $this->get('route_parameters')->first()->getValue();
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setRouteParams($route_parameters) { public function setRouteParameters($route_parameters) {
$this->set('route_parameters', $route_parameters); $this->set('route_parameters', $route_parameters);
return $this; return $this;
} }
...@@ -146,7 +146,7 @@ public function preSave(EntityStorageInterface $storage) { ...@@ -146,7 +146,7 @@ public function preSave(EntityStorageInterface $storage) {
$url = Url::createFromRequest(Request::create("/{$this->path->value}")); $url = Url::createFromRequest(Request::create("/{$this->path->value}"));
} }
$this->setRouteName($url->getRouteName()); $this->setRouteName($url->getRouteName());
$this->setRouteParams($url->getRouteParameters()); $this->setRouteParameters($url->getRouteParameters());
} }
/** /**
......
...@@ -85,7 +85,7 @@ public function setRouteName($route_name); ...@@ -85,7 +85,7 @@ public function setRouteName($route_name);
* @return array * @return array
* The route parameters of this shortcut. * The route parameters of this shortcut.
*/ */
public function getRouteParams(); public function getRouteParameters();
/** /**
* Sets the route parameters associated with this shortcut. * Sets the route parameters associated with this shortcut.
...@@ -96,6 +96,6 @@ public function getRouteParams(); ...@@ -96,6 +96,6 @@ public function getRouteParams();
* @return \Drupal\shortcut\ShortcutInterface * @return \Drupal\shortcut\ShortcutInterface
* The called shortcut entity. * The called shortcut entity.
*/ */
public function setRouteParams($route_parameters); public function setRouteParameters($route_parameters);
} }
...@@ -25,7 +25,7 @@ public function getValue() { ...@@ -25,7 +25,7 @@ public function getValue() {
$entity = $this->parent->getEntity(); $entity = $this->parent->getEntity();
if ($route_name = $entity->getRouteName()) { 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, '/'); $this->value = trim($path, '/');
} }
else { else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment