diff --git a/core/lib/Drupal/Core/Menu/MenuLinkDefault.php b/core/lib/Drupal/Core/Menu/MenuLinkDefault.php index c224142..b29f599 100644 --- a/core/lib/Drupal/Core/Menu/MenuLinkDefault.php +++ b/core/lib/Drupal/Core/Menu/MenuLinkDefault.php @@ -67,16 +67,7 @@ public static function create(ContainerInterface $container, array $configuratio * {@inheritdoc} */ public function getTitle() { - // Subclasses may pull in the request or specific attributes as parameters. - $options = array(); - if (!empty($this->pluginDefinition['title_context'])) { - $options['context'] = $this->pluginDefinition['title_context']; - } - $args = array(); - if (isset($this->pluginDefinition['title_arguments']) && $title_arguments = $this->pluginDefinition['title_arguments']) { - $args = (array) $title_arguments; - } - return $this->t($this->pluginDefinition['title'], $args, $options); + return (string) $this->pluginDefinition['title']; } /** diff --git a/core/lib/Drupal/Core/Menu/MenuLinkManager.php b/core/lib/Drupal/Core/Menu/MenuLinkManager.php index b4c7760..44eeeb3 100644 --- a/core/lib/Drupal/Core/Menu/MenuLinkManager.php +++ b/core/lib/Drupal/Core/Menu/MenuLinkManager.php @@ -41,14 +41,9 @@ class MenuLinkManager implements MenuLinkManagerInterface { 'route_parameters' => array(), // The external URL if this link has one (required if route_name is empty). 'url' => '', - // The static title for the menu link. You can specify placeholders like on - // any translatable string and the values in title_arguments. + // The static title for the menu link. If this came from a YAML definition + // or other safe source this may be a TranslationWrapper object. 'title' => '', - // The values for the menu link placeholders. - 'title_arguments' => array(), - // A context for the title string. - // @see \Drupal\Core\StringTranslation\TranslationInterface::translate() - 'title_context' => '', // The description. 'description' => '', // The plugin ID of the parent link (or NULL for a top-level link). @@ -148,8 +143,10 @@ protected function processDefinition(array &$definition, $plugin_id) { */ protected function getDiscovery() { if (!isset($this->discovery)) { - $this->discovery = new YamlDiscovery('links.menu', $this->moduleHandler->getModuleDirectories()); - $this->discovery = new ContainerDerivativeDiscoveryDecorator($this->discovery); + $yaml_discovery = new YamlDiscovery('links.menu', $this->moduleHandler->getModuleDirectories()); + $yaml_discovery->addTranslatableProperty('title', 'title_context'); + $yaml_discovery->addTranslatableProperty('description', 'description_context'); + $this->discovery = new ContainerDerivativeDiscoveryDecorator($yaml_discovery); } return $this->discovery; } diff --git a/core/lib/Drupal/Core/Menu/MenuTreeStorage.php b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php index 659d6be..88cc8e8 100644 --- a/core/lib/Drupal/Core/Menu/MenuTreeStorage.php +++ b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php @@ -95,8 +95,6 @@ class MenuTreeStorage implements MenuTreeStorageInterface { 'route_parameters', 'url', 'title', - 'title_arguments', - 'title_context', 'description', 'parent', 'weight', @@ -1242,30 +1240,18 @@ protected static function schemaDefinition() { 'default' => '', ), 'title' => array( - 'description' => 'The text displayed for the link.', - 'type' => 'varchar', - 'length' => 255, - 'not null' => TRUE, - 'default' => '', - ), - 'title_arguments' => array( - 'description' => 'A serialized array of arguments to be passed to t() (if this plugin uses it).', + 'description' => 'The title for the link. May be a serialized TranslationWrapper', 'type' => 'blob', 'size' => 'big', 'not null' => FALSE, 'serialize' => TRUE, ), - 'title_context' => array( - 'description' => 'The translation context for the link title.', - 'type' => 'varchar', - 'length' => 255, - 'not null' => TRUE, - 'default' => '', - ), 'description' => array( 'description' => 'The description of this link - used for admin pages and title attribute.', - 'type' => 'text', + 'type' => 'blob', + 'size' => 'big', 'not null' => FALSE, + 'serialize' => TRUE, ), 'class' => array( 'description' => 'The class for this link plugin.',