diff --git a/core/includes/menu.inc b/core/includes/menu.inc
index fd6cb3c..c55ac61 100644
--- a/core/includes/menu.inc
+++ b/core/includes/menu.inc
@@ -1753,7 +1753,7 @@ function theme_menu_local_task($variables) {
$a_tag = l($link_text, $link['href'], $link['localized_options']);
}
else {
- $a_tag = Drupal::l($link_text, $link['route_name'], $link['route_parameters'], $link['localized_options']);
+ $a_tag = \Drupal::l($link_text, $link['route_name'], $link['route_parameters'], $link['localized_options']);
}
return '
' . $a_tag . '';
diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module
index cb75829..b0b1d27 100644
--- a/core/modules/menu/menu.module
+++ b/core/modules/menu/menu.module
@@ -585,7 +585,8 @@ function menu_node_submit(EntityInterface $node, $form, $form_state) {
// Decompose the selected menu parent option into 'menu_name' and 'plid', if
// the form used the default parent selection widget.
if (!empty($form_state['values']['menu']['parent'])) {
- list($node->menu['menu_name'], $node->menu['plid']) = explode(':', $form_state['values']['menu']['parent']);
+ $parts = explode(':', $form_state['values']['menu']['parent']);
+ $node->menu->setMenuName($parts[0])->setParentLinkId($parts[1]);
}
}
diff --git a/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php b/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php
index 5145d85..40f4c9c 100644
--- a/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php
+++ b/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php
@@ -246,6 +246,15 @@ public function offsetUnset($offset) {
}
}
+ public function __set($name, $value) {
+ if (in_array($name, $this->oldRoutingProperties)) {
+ $this->oldRouterItem[$name] = $value;
+ }
+ else {
+ parent::__set($name, $value);
+ }
+ }
+
/**
* {@inheritdoc}
*/
@@ -419,7 +428,7 @@ public static function findRouteNameParameters($link_path) {
return array();
}
}
-
+
/**
* {@inheritdoc}
*/
@@ -499,7 +508,7 @@ public function set($property_name, $value, $notify = TRUE) {
parent::set($property_name, $value, $notify);
}
}
-
+
/**
* {@inheritdoc}
*/
@@ -719,7 +728,7 @@ public function setRouteName($route_name) {
public function getAccess() {
return $this->get('access')->value;
}
-
+
public function setAccess($access) {
$this->set('access', $access);
return $this;
@@ -730,7 +739,7 @@ public function setAccess($access) {
public function getRouteParams() {
return $this->get('route_parameters')->value;
}
-
+
/**
* {@inheritdoc}
*/
diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php
index 49c9e9d..918a414 100644
--- a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php
+++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkFormController.php
@@ -218,14 +218,14 @@ protected function actions(array $form, array &$form_state) {
public function validate(array $form, array &$form_state) {
$menu_link = $this->buildEntity($form, $form_state);
- $normal_path = $this->pathAliasManager->getSystemPath($menu_link->link_path->value);
- if ($menu_link->link_path->value != $normal_path) {
- drupal_set_message(t('The menu system stores system paths only, but will use the URL alias for display. %link_path has been stored as %normal_path', array('%link_path' => $menu_link->link_path, '%normal_path' => $normal_path)));
+ $normal_path = $this->pathAliasManager->getSystemPath($menu_link->getLinkPath());
+ if ($menu_link->getLinkPath() != $normal_path) {
+ drupal_set_message(t('The menu system stores system paths only, but will use the URL alias for display. %link_path has been stored as %normal_path', array('%link_path' => $menu_link->getLinkPath(), '%normal_path' => $normal_path)));
$form_state['values']['link_path'] = $normal_path;
- $menu_link->link_path->value = $normal_path;
+ $menu_link->setLinkPath($normal_path);
}
- if (!url_is_external($menu_link->link_path->value)) {
- $parsed_link = parse_url($menu_link->link_path->value);
+ if (!url_is_external($menu_link->getLinkPath())) {
+ $parsed_link = parse_url($menu_link->getLinkPath());
if (isset($parsed_link['query'])) {
$query = array();
parse_str($parsed_link['query'], $query);
@@ -240,12 +240,12 @@ public function validate(array $form, array &$form_state) {
else {
$menu_link->options->fragment = '';
}
- if (isset($parsed_link['path']) && $menu_link->link_path->value != $parsed_link['path']) {
- $menu_link->link_path->value = $parsed_link['path'];
+ if (isset($parsed_link['path']) && $menu_link->getLinkPath() != $parsed_link['path']) {
+ $menu_link->setLinkPath($parsed_link['path']);
}
}
- if (!trim($menu_link->link_path->value) || !drupal_valid_path($menu_link->link_path->value, TRUE)) {
- form_set_error('link_path', t("The path '@link_path' is either invalid or you do not have access to it.", array('@link_path' => $menu_link->link_path->value)));
+ if (!trim($menu_link->getLinkPath()) || !drupal_valid_path($menu_link->getLinkPath(), TRUE)) {
+ form_set_error('link_path', t("The path '@link_path' is either invalid or you do not have access to it.", array('@link_path' => $menu_link->getLinkPath())));
}
parent::validate($form, $form_state);
diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php
index e14b042..08d70dc 100644
--- a/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php
+++ b/core/modules/shortcut/lib/Drupal/shortcut/Tests/ShortcutLinksTest.php
@@ -78,7 +78,7 @@ function testShortcutQuickLink() {
$link = reset($this->set->links);
- $this->drupalGet($link->link_path);
+ $this->drupalGet($link->getLinkPath());
$this->assertRaw(t('Remove from %title shortcuts', array('%title' => $this->set->label())), '"Add to shortcuts" link properly switched to "Remove from shortcuts".');
}
@@ -92,7 +92,7 @@ function testShortcutLinkRename() {
$new_link_name = $this->randomName();
$link = reset($set->links);
- $this->drupalPostForm('admin/config/user-interface/shortcut/link/' . $link->id(), array('shortcut_link[link_title]' => $new_link_name, 'shortcut_link[link_path]' => $link->link_path), t('Save'));
+ $this->drupalPostForm('admin/config/user-interface/shortcut/link/' . $link->id(), array('shortcut_link[link_title]' => $new_link_name, 'shortcut_link[link_path]' => $link->getLinkPath()), t('Save'));
$saved_set = shortcut_set_load($set->id());
$titles = $this->getShortcutInformation($saved_set, 'link_title');
$this->assertTrue(in_array($new_link_name, $titles), 'Shortcut renamed: ' . $new_link_name);
@@ -109,7 +109,7 @@ function testShortcutLinkChangePath() {
$new_link_path = 'admin/config';
$link = reset($set->links);
- $this->drupalPostForm('admin/config/user-interface/shortcut/link/' . $link->id(), array('shortcut_link[link_title]' => $link->link_title->value, 'shortcut_link[link_path]' => $new_link_path), t('Save'));
+ $this->drupalPostForm('admin/config/user-interface/shortcut/link/' . $link->id(), array('shortcut_link[link_title]' => $link->getLinkTitle(), 'shortcut_link[link_path]' => $new_link_path), t('Save'));
$saved_set = shortcut_set_load($set->id());
$paths = $this->getShortcutInformation($saved_set, 'link_path');
$this->assertTrue(in_array($new_link_path, $paths), 'Shortcut path changed: ' . $new_link_path);