diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 8141de9..caa757d 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -870,7 +870,7 @@ function menu_tail_load($arg, &$map, $index) { */ function _menu_link_translate(&$item, $translate = FALSE) { if (!is_array($item['options'])) { - $item['options'] = unserialize($item['options']); + //$item['options'] = unserialize($item['options']); } if ($item['external']) { $item['access'] = 1; @@ -1883,7 +1883,7 @@ function menu_navigation_links($menu_name, $level = 0) { foreach ($tree as $item) { if (!$item['link']['hidden']) { $class = ''; - $l = $item['link']['localized_options']; + $l = $item['link']['localized_options']->getValue(); $l['href'] = $item['link']['href']; $l['title'] = $item['link']['title']; if ($item['link']['in_active_trail']) { @@ -2651,7 +2651,7 @@ function menu_get_active_breadcrumb() { } foreach ($active_trail as $parent) { - $breadcrumb[] = l($parent['title'], $parent['href'], $parent['localized_options']); + $breadcrumb[] = l($parent['title'], $parent['href'], is_array($parent['localized_options']) ? $parent['localized_options'] : $parent['localized_options']->getValue()); } } return $breadcrumb; diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 7bff76e..2e69daf 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1762,9 +1762,9 @@ function theme_links($variables) { // Handle title-only text items. else { // Merge in default array properties into $link. - $link += array( - 'html' => FALSE, - ); + if (!isset($link['html'])) { + $link['html'] = FALSE; + } $item = ($link['html'] ? $link['title'] : check_plain($link['title'])); if (isset($link['attributes'])) { $item = '' . $item . ''; diff --git a/core/lib/Drupal/Core/Entity/Plugin/DataType/MapItem.php b/core/lib/Drupal/Core/Entity/Plugin/DataType/MapItem.php index 1c8a1a9..073654b 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/DataType/MapItem.php +++ b/core/lib/Drupal/Core/Entity/Plugin/DataType/MapItem.php @@ -21,7 +21,7 @@ * list_class = "\Drupal\Core\Entity\Field\Field" * ) */ -class MapItem extends FieldItemBase { +class MapItem extends FieldItemBase implements \ArrayAccess { /** * Definitions of the contained properties. @@ -46,4 +46,70 @@ public function getPropertyDefinitions() { return static::$propertyDefinitions; } + /** + * (PHP 5 >= 5.0.0)
+ * Whether a offset exists + * @link http://php.net/manual/en/arrayaccess.offsetexists.php + * @param mixed $offset

+ * An offset to check for. + *

+ * @return boolean true on success or false on failure. + *

+ *

+ * The return value will be casted to boolean if non-boolean was returned. + */ + public function offsetExists($offset) { + return !(isset($this->values[$offset]) && isset($this->properties[$offset])); + } + + /** + * (PHP 5 >= 5.0.0)
+ * Offset to retrieve + * @link http://php.net/manual/en/arrayaccess.offsetget.php + * @param mixed $offset

+ * The offset to retrieve. + *

+ * @return mixed Can return all value types. + */ + public function offsetGet($offset) { + // There is either a property object or a plain value - possibly for a + // not-defined property. If we have a plain value, directly return it. + if (isset($this->values[$offset])) { + return $this->values[$offset]; + } + elseif (isset($this->properties[$offset])) { + return $this->properties[$offset]->getValue(); + } + } + + /** + * (PHP 5 >= 5.0.0)
+ * Offset to set + * @link http://php.net/manual/en/arrayaccess.offsetset.php + * @param mixed $offset

+ * The offset to assign the value to. + *

+ * @param mixed $value

+ * The value to set. + *

+ * @return void + */ + public function offsetSet($offset, $value) { + $this->set($offset, $value); + } + + /** + * (PHP 5 >= 5.0.0)
+ * Offset to unset + * @link http://php.net/manual/en/arrayaccess.offsetunset.php + * @param mixed $offset

+ * The offset to unset. + *

+ * @return void + */ + public function offsetUnset($offset) { + $this->set($offset, NULL); + } + + } diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index df5f602..c0df0f3 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -210,7 +210,7 @@ function menu_enable() { $system_link = reset($system_link); $base_link = entity_create('menu_link', array( - 'menu_name' => $system_link->menu_name, + 'menu_name' => $system_link->menu_name->value, 'router_path' => 'admin/structure/menu/manage/%', 'module' => 'menu', )); @@ -223,8 +223,8 @@ function menu_enable() { $link->link_path = 'admin/structure/menu/manage/' . $menu->id(); $query = Drupal::entityQuery('menu_link') - ->condition('link_path', $link->link_path) - ->condition('plid', $link->plid); + ->condition('link_path', $link->link_path->value) + ->condition('plid', $link->plid->value); $result = $query->execute(); if (empty($result)) { diff --git a/core/modules/menu_link/lib/Drupal/menu_link/Plugin/Core/Entity/MenuLink.php b/core/modules/menu_link/lib/Drupal/menu_link/Plugin/Core/Entity/MenuLink.php index f7ad7ce..245b9a4 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/Plugin/Core/Entity/MenuLink.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/Plugin/Core/Entity/MenuLink.php @@ -447,9 +447,15 @@ public function offsetGet($offset) { if (in_array($offset, $this->oldRoutingProperties)) { return $this->oldRouterItem[$offset]; } - - return $this->{$offset}->value; -// return $this->{$offset}; + elseif ($offset == 'localized_options' || $offset == 'options') { + return $this->{$offset}[0]; + } + elseif ($this->getPropertyDefinition($offset)) { + return $this->{$offset}->value; + } + else { + return $this->{$offset}; + } } /** @@ -459,10 +465,12 @@ public function offsetSet($offset, $value) { if (in_array($offset, $this->oldRoutingProperties)) { $this->oldRouterItem[$offset] = $value; } - else { + elseif ($this->getPropertyDefinition($offset)) { $this->{$offset}->value = $value; } -// $this->{$offset} = $value; + else { + $this->{$offset} = $value; + } } /** diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index c22c97f..514f1d1 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -55,7 +55,7 @@ function shortcut_entity_bundle_info() { function shortcut_menu_link_load($entities) { foreach ($entities as $entity) { // Change the bundle of menu links related to a shortcut. - if (strpos($entity->menu_name, 'shortcut-') === 0) { + if (strpos($entity->menu_name->value, 'shortcut-') === 0) { $entity->bundle = 'shortcut'; } }