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 90c352a..3607376 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 @@ -9,13 +9,14 @@ use Drupal\Core\Annotation\Translation; use Drupal\Core\Entity\Annotation\EntityType; +use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityNG; use Drupal\Core\Entity\EntityStorageControllerInterface; +use Drupal\Core\TypedData\TypedDataInterface; use Drupal\menu_link\MenuLinkInterface; use Drupal\menu_link\MenuLinkStorageControllerInterface; use Symfony\Component\Routing\Route; use Symfony\Component\HttpFoundation\Request; -use Drupal\Core\Entity\Plugin\DataType\MapItem; /** * Defines the menu link entity class. @@ -702,204 +703,204 @@ public function setRouteName($route_name) { * {@inheritdoc} */ public static function baseFieldDefinitions($entity_type) { - $properties['menu_name'] = array( - 'label' => t('Menu name'), - 'description' => t('The menu name. All links with the same menu name (such as "tools") are part of the same menu.'), - 'type' => 'string_field', - 'settings' => array( - 'default_value' => 'tools', - ), - ); - $properties['mlid'] = array( - 'label' => t('Menu link ID'), - 'description' => t('The menu link ID.'), - 'type' => 'integer_field', - 'read-only' => TRUE, - ); - $properties['uuid'] = array( - 'label' => t('UUID'), - 'description' => t('The menu link UUID.'), - 'type' => 'uuid_field', - 'read-only' => TRUE, - ); - $properties['plid'] = array( - 'label' => t('Parent ID'), - 'description' => t('The parent menu link ID.'), - 'type' => 'entity_reference_field', - 'settings' => array('target_type' => 'menu_link'), - ); - $properties['link_path'] = array( - 'label' => t('Link path'), - 'description' => t('The Drupal path or external path this link points to.'), - 'type' => 'string_field', - ); - $properties['router_path'] = array( - 'label' => t('Router path'), - 'description' => t('For links corresponding to a Drupal path (external = 0), this connects the link to a {menu_router}.path.'), - 'type' => 'string_field', - ); - $properties['langcode'] = array( - 'label' => t('Language code'), - 'description' => t('The menu link language code.'), - 'type' => 'language_field', - ); - $properties['link_title'] = array( - 'label' => t('Title'), - 'description' => t('The text displayed for the link, which may be modified by a title callback stored in {menu_router}.'), - 'type' => 'string_field', - 'settings' => array( - 'default_value' => '', - ), - ); - $properties['options'] = array( - 'label' => t('Options'), - 'description' => t('A serialized array of options to be passed to the url() or l() function, such as a query string or HTML attributes.'), - 'type' => 'map_field', - ); - $properties['module'] = array( - 'label' => t('Module'), - 'description' => t('The name of the module that generated this link.'), - 'type' => 'string_field', - 'settings' => array( - 'default_value' => 'menu', - ), - ); - $properties['hidden'] = array( - 'label' => t('Hidden'), - 'description' => t('A flag for whether the link should be rendered in menus. (1 = a disabled menu item that may be shown on admin screens, -1 = a menu callback, 0 = a normal, visible link).'), - 'type' => 'boolean_field', - 'settings' => array( - 'default_value' => 0, - ), - ); - $properties['external'] = array( - 'label' => t('External'), - 'description' => t('A flag to indicate if the link points to a full URL starting with a protocol, like http:// (1 = external, 0 = internal).'), - 'type' => 'boolean_field', - 'settings' => array( - 'default_value' => 0, - ), - ); - $properties['has_children'] = array( - 'label' => t('Has children'), - 'description' => t('Flag indicating whether any links have this link as a parent (1 = children exist, 0 = no children).'), - 'type' => 'boolean_field', - 'settings' => array( - 'default_value' => 0, - ), - ); - $properties['expanded'] = array( - 'label' => t('Expanded'), - 'description' => t('Flag for whether this link should be rendered as expanded in menus - expanded links always have their child links displayed, instead of only when the link is in the active trail (1 = expanded, 0 = not expanded).'), - 'type' => 'boolean_field', - 'settings' => array( - 'default_value' => 0, - ), - ); - $properties['weight'] = array( - 'label' => t('Weight'), - 'description' => t('Link weight among links in the same menu at the same depth.'), - 'type' => 'integer_field', - 'settings' => array( - 'default_value' => 0, - ), - ); - $properties['depth'] = array( - 'label' => t('Depth'), - 'description' => t('The depth relative to the top level. A link with plid == 0 will have depth == 1.'), - 'type' => 'integer_field', - ); - $properties['customized'] = array( - 'label' => t('Customized'), - 'description' => t('A flag to indicate that the user has manually created or edited the link (1 = customized, 0 = not customized).'), - 'type' => 'boolean_field', - 'settings' => array( - 'default_value' => 0, - ), - ); - // @todo Declaring these pX properties as integer for the moment, we need to - // investigate if using 'entity_reference_field' cripples performance. - $properties['p1'] = array( - 'label' => t('Parent 1'), - 'description' => t('The first mlid in the materialized path.'), - 'type' => 'integer_field', - ); - $properties['p2'] = array( - 'label' => t('Parent 2'), - 'description' => t('The second mlid in the materialized path.'), - 'type' => 'integer_field', - ); - $properties['p3'] = array( - 'label' => t('Parent 3'), - 'description' => t('The third mlid in the materialized path.'), - 'type' => 'integer_field', - ); - $properties['p4'] = array( - 'label' => t('Parent 4'), - 'description' => t('The fourth mlid in the materialized path.'), - 'type' => 'integer_field', - ); - $properties['p5'] = array( - 'label' => t('Parent 5'), - 'description' => t('The fifth mlid in the materialized path.'), - 'type' => 'integer_field', - ); - $properties['p6'] = array( - 'label' => t('Parent 6'), - 'description' => t('The sixth mlid in the materialized path.'), - 'type' => 'integer_field', - ); - $properties['p7'] = array( - 'label' => t('Parent 7'), - 'description' => t('The seventh mlid in the materialized path.'), - 'type' => 'integer_field', - ); - $properties['p8'] = array( - 'label' => t('Parent 8'), - 'description' => t('The eighth mlid in the materialized path.'), - 'type' => 'integer_field', - ); - $properties['p9'] = array( - 'label' => t('Parent 9'), - 'description' => t('The ninth mlid in the materialized path.'), - 'type' => 'integer_field', - ); - $properties['updated'] = array( - 'label' => t('Updated'), - 'description' => t('Flag that indicates that this link was generated during the update from Drupal 5.'), - 'type' => 'boolean_field', - ); - $properties['route_name'] = array( - 'label' => t('Route name'), - 'description' => t('The machine name of a defined Symfony Route this menu item represents.'), - 'type' => 'string_field', - ); - $properties['route_parameters'] = array( - 'label' => t('Route parameters'), - 'description' => t('A serialized array of route parameters of this menu link.'), - 'type' => 'map_field', - ); - - // @todo Most of these should probably go away. - $properties['access'] = array( - 'label' => t('(old router) Access'), - 'description' => t(''), - 'type' => 'boolean_field', - 'computed' => TRUE, - ); - $properties['in_active_trail'] = array( - 'label' => t('In active trail'), - 'description' => t(''), - 'type' => 'boolean_field', - 'computed' => TRUE, - ); - $properties['localized_options'] = array( - 'label' => t('Localized options'), - 'description' => t(''), - 'type' => 'map_field', - 'computed' => TRUE, - ); - return $properties; + $properties['menu_name'] = array( + 'label' => t('Menu name'), + 'description' => t('The menu name. All links with the same menu name (such as "tools") are part of the same menu.'), + 'type' => 'string_field', + 'settings' => array( + 'default_value' => 'tools', + ), + ); + $properties['mlid'] = array( + 'label' => t('Menu link ID'), + 'description' => t('The menu link ID.'), + 'type' => 'integer_field', + 'read-only' => TRUE, + ); + $properties['uuid'] = array( + 'label' => t('UUID'), + 'description' => t('The menu link UUID.'), + 'type' => 'uuid_field', + 'read-only' => TRUE, + ); + $properties['plid'] = array( + 'label' => t('Parent ID'), + 'description' => t('The parent menu link ID.'), + 'type' => 'entity_reference_field', + 'settings' => array('target_type' => 'menu_link'), + ); + $properties['link_path'] = array( + 'label' => t('Link path'), + 'description' => t('The Drupal path or external path this link points to.'), + 'type' => 'string_field', + ); + $properties['router_path'] = array( + 'label' => t('Router path'), + 'description' => t('For links corresponding to a Drupal path (external = 0), this connects the link to a {menu_router}.path.'), + 'type' => 'string_field', + ); + $properties['langcode'] = array( + 'label' => t('Language code'), + 'description' => t('The menu link language code.'), + 'type' => 'language_field', + ); + $properties['link_title'] = array( + 'label' => t('Title'), + 'description' => t('The text displayed for the link, which may be modified by a title callback stored in {menu_router}.'), + 'type' => 'string_field', + 'settings' => array( + 'default_value' => '', + ), + ); + $properties['options'] = array( + 'label' => t('Options'), + 'description' => t('A serialized array of options to be passed to the url() or l() function, such as a query string or HTML attributes.'), + 'type' => 'map_field', + ); + $properties['module'] = array( + 'label' => t('Module'), + 'description' => t('The name of the module that generated this link.'), + 'type' => 'string_field', + 'settings' => array( + 'default_value' => 'menu', + ), + ); + $properties['hidden'] = array( + 'label' => t('Hidden'), + 'description' => t('A flag for whether the link should be rendered in menus. (1 = a disabled menu item that may be shown on admin screens, -1 = a menu callback, 0 = a normal, visible link).'), + 'type' => 'boolean_field', + 'settings' => array( + 'default_value' => 0, + ), + ); + $properties['external'] = array( + 'label' => t('External'), + 'description' => t('A flag to indicate if the link points to a full URL starting with a protocol, like http:// (1 = external, 0 = internal).'), + 'type' => 'boolean_field', + 'settings' => array( + 'default_value' => 0, + ), + ); + $properties['has_children'] = array( + 'label' => t('Has children'), + 'description' => t('Flag indicating whether any links have this link as a parent (1 = children exist, 0 = no children).'), + 'type' => 'boolean_field', + 'settings' => array( + 'default_value' => 0, + ), + ); + $properties['expanded'] = array( + 'label' => t('Expanded'), + 'description' => t('Flag for whether this link should be rendered as expanded in menus - expanded links always have their child links displayed, instead of only when the link is in the active trail (1 = expanded, 0 = not expanded).'), + 'type' => 'boolean_field', + 'settings' => array( + 'default_value' => 0, + ), + ); + $properties['weight'] = array( + 'label' => t('Weight'), + 'description' => t('Link weight among links in the same menu at the same depth.'), + 'type' => 'integer_field', + 'settings' => array( + 'default_value' => 0, + ), + ); + $properties['depth'] = array( + 'label' => t('Depth'), + 'description' => t('The depth relative to the top level. A link with plid == 0 will have depth == 1.'), + 'type' => 'integer_field', + ); + $properties['customized'] = array( + 'label' => t('Customized'), + 'description' => t('A flag to indicate that the user has manually created or edited the link (1 = customized, 0 = not customized).'), + 'type' => 'boolean_field', + 'settings' => array( + 'default_value' => 0, + ), + ); + // @todo Declaring these pX properties as integer for the moment, we need to + // investigate if using 'entity_reference_field' cripples performance. + $properties['p1'] = array( + 'label' => t('Parent 1'), + 'description' => t('The first mlid in the materialized path.'), + 'type' => 'integer_field', + ); + $properties['p2'] = array( + 'label' => t('Parent 2'), + 'description' => t('The second mlid in the materialized path.'), + 'type' => 'integer_field', + ); + $properties['p3'] = array( + 'label' => t('Parent 3'), + 'description' => t('The third mlid in the materialized path.'), + 'type' => 'integer_field', + ); + $properties['p4'] = array( + 'label' => t('Parent 4'), + 'description' => t('The fourth mlid in the materialized path.'), + 'type' => 'integer_field', + ); + $properties['p5'] = array( + 'label' => t('Parent 5'), + 'description' => t('The fifth mlid in the materialized path.'), + 'type' => 'integer_field', + ); + $properties['p6'] = array( + 'label' => t('Parent 6'), + 'description' => t('The sixth mlid in the materialized path.'), + 'type' => 'integer_field', + ); + $properties['p7'] = array( + 'label' => t('Parent 7'), + 'description' => t('The seventh mlid in the materialized path.'), + 'type' => 'integer_field', + ); + $properties['p8'] = array( + 'label' => t('Parent 8'), + 'description' => t('The eighth mlid in the materialized path.'), + 'type' => 'integer_field', + ); + $properties['p9'] = array( + 'label' => t('Parent 9'), + 'description' => t('The ninth mlid in the materialized path.'), + 'type' => 'integer_field', + ); + $properties['updated'] = array( + 'label' => t('Updated'), + 'description' => t('Flag that indicates that this link was generated during the update from Drupal 5.'), + 'type' => 'boolean_field', + ); + $properties['route_name'] = array( + 'label' => t('Route name'), + 'description' => t('The machine name of a defined Symfony Route this menu item represents.'), + 'type' => 'string_field', + ); + $properties['route_parameters'] = array( + 'label' => t('Route parameters'), + 'description' => t('A serialized array of route parameters of this menu link.'), + 'type' => 'map_field', + ); + + // @todo Most of these should probably go away. + $properties['access'] = array( + 'label' => t('(old router) Access'), + 'description' => t(''), + 'type' => 'boolean_field', + 'computed' => TRUE, + ); + $properties['in_active_trail'] = array( + 'label' => t('In active trail'), + 'description' => t(''), + 'type' => 'boolean_field', + 'computed' => TRUE, + ); + $properties['localized_options'] = array( + 'label' => t('Localized options'), + 'description' => t(''), + 'type' => 'map_field', + 'computed' => TRUE, + ); + return $properties; } - + } diff --git a/core/modules/system/lib/Drupal/system/Controller/SystemController.php b/core/modules/system/lib/Drupal/system/Controller/SystemController.php index 470b5bb..ee46955 100644 --- a/core/modules/system/lib/Drupal/system/Controller/SystemController.php +++ b/core/modules/system/lib/Drupal/system/Controller/SystemController.php @@ -78,7 +78,7 @@ public function overview() { $system_link = reset($system_link); $query = $this->queryFactory->get('menu_link') ->condition('link_path', 'admin/help', '<>') - ->condition('menu_name', $system_link->menu_name) + ->condition('menu_name', $system_link->getMenuName()) ->condition('plid', $system_link->id()) ->condition('hidden', 0); $result = $query->execute(); @@ -95,7 +95,11 @@ public function overview() { $item['description'] = $item['localized_options']['attributes']['title']; unset($item['localized_options']['attributes']['title']); } - $block = $item; + $block = array( + 'title' => $item->getLinkTitle(), + 'description' => $item['description'], + 'position' => $item['position'], + ); $block['content'] = array( '#theme' => 'admin_block_content', '#content' => $this->systemManager->getAdminBlock($item), diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 5222f25..b4089ca 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -2263,6 +2263,7 @@ function system_update_8060() { 'size' => 'big', 'not null' => FALSE, 'serialize' => TRUE, + 'initial' => 'a:0:{}', ); db_add_field('menu_links', 'route_parameters', $spec);