Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
@ -19,8 +19,8 @@
|
|||
attach: function (context) {
|
||||
$(context).find('.menu-link-form').drupalSetSummary(function (context) {
|
||||
var $context = $(context);
|
||||
if ($context.find('.form-item-menu-enabled input').is(':checked')) {
|
||||
return Drupal.checkPlain($context.find('.form-item-menu-title input').val());
|
||||
if ($context.find('.js-form-item-menu-enabled input').is(':checked')) {
|
||||
return Drupal.checkPlain($context.find('.js-form-item-menu-title input').val());
|
||||
}
|
||||
else {
|
||||
return Drupal.t('Not in menu');
|
||||
|
@ -46,9 +46,9 @@
|
|||
// Try to find menu settings widget elements as well as a 'title' field
|
||||
// in the form, but play nicely with user permissions and form
|
||||
// alterations.
|
||||
var $checkbox = $this.find('.form-item-menu-enabled input');
|
||||
var $link_title = $context.find('.form-item-menu-title input');
|
||||
var $title = $this.closest('form').find('.form-item-title-0-value input');
|
||||
var $checkbox = $this.find('.js-form-item-menu-enabled input');
|
||||
var $link_title = $context.find('.js-form-item-menu-title input');
|
||||
var $title = $this.closest('form').find('.js-form-item-title-0-value input');
|
||||
// Bail out if we do not have all required fields.
|
||||
if (!($checkbox.length && $link_title.length && $title.length)) {
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
entity.menu.collection:
|
||||
title: Menus
|
||||
description: 'Add new menus to your site, edit existing menus, and rename and reorganize menu links.'
|
||||
description: 'Manage menus and menu links.'
|
||||
route_name: entity.menu.collection
|
||||
parent: system.admin_structure
|
||||
|
|
|
@ -37,21 +37,21 @@ function menu_ui_help($route_name, RouteMatchInterface $route_match) {
|
|||
case 'help.page.menu_ui':
|
||||
$output = '';
|
||||
$output .= '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . t('The Menu UI module provides an interface for managing menus. A menu is a hierarchical collection of links, which can be within or external to the site, generally used for navigation. For more information, see the <a href="!menu">online documentation for the Menu UI module</a>.', array('!menu' => 'https://www.drupal.org/documentation/modules/menu/')) . '</p>';
|
||||
$output .= '<p>' . t('The Menu UI module provides an interface for managing menus. A menu is a hierarchical collection of links, which can be within or external to the site, generally used for navigation. For more information, see the <a href=":menu">online documentation for the Menu UI module</a>.', array(':menu' => 'https://www.drupal.org/documentation/modules/menu/')) . '</p>';
|
||||
$output .= '<h3>' . t('Uses') . '</h3>';
|
||||
$output .= '<dl>';
|
||||
$output .= '<dt>' . t('Managing menus') . '</dt>';
|
||||
$output .= '<dd>' . t('Users with the <em>Administer menus and menu items</em> permission can add, edit, and delete custom menus on the <a href="!menu">Menus page</a>. Custom menus can be special site menus, menus of external links, or any combination of internal and external links. You may create an unlimited number of additional menus, each of which will automatically have an associated block (if you have the <a href="!block_help">Block module</a> installed). By selecting <em>Edit menu</em>, you can add, edit, or delete links for a given menu. The links listing page provides a drag-and-drop interface for controlling the order of links, and creating a hierarchy within the menu.', array('!block_help' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('help.page', array('name' => 'block')) : '#', '!menu' => \Drupal::url('entity.menu.collection'))) . '</dd>';
|
||||
$output .= '<dd>' . t('Users with the <em>Administer menus and menu items</em> permission can add, edit, and delete custom menus on the <a href=":menu">Menus page</a>. Custom menus can be special site menus, menus of external links, or any combination of internal and external links. You may create an unlimited number of additional menus, each of which will automatically have an associated block (if you have the <a href=":block_help">Block module</a> installed). By selecting <em>Edit menu</em>, you can add, edit, or delete links for a given menu. The links listing page provides a drag-and-drop interface for controlling the order of links, and creating a hierarchy within the menu.', array(':block_help' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('help.page', array('name' => 'block')) : '#', ':menu' => \Drupal::url('entity.menu.collection'))) . '</dd>';
|
||||
$output .= '<dt>' . t('Displaying menus') . '</dt>';
|
||||
$output .= '<dd>' . t('If you have the Block module enabled, then each menu that you create is rendered in a block that you enable and position on the <a href="!blocks">Block layout page</a>. In some <a href="!themes">themes</a>, the main menu and possibly the secondary menu will be output automatically; you may be able to disable this behavior on the <a href="!themes">theme\'s settings page</a>.', array('!blocks' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#', '!themes' => \Drupal::url('system.themes_page'), '!theme_settings' => \Drupal::url('system.theme_settings'))) . '</dd>';
|
||||
$output .= '<dd>' . t('If you have the Block module enabled, then each menu that you create is rendered in a block that you enable and position on the <a href=":blocks">Block layout page</a>. In some <a href=":themes">themes</a>, the main menu and possibly the secondary menu will be output automatically; you may be able to disable this behavior on the <a href=":themes">theme\'s settings page</a>.', array(':blocks' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#', ':themes' => \Drupal::url('system.themes_page'), ':theme_settings' => \Drupal::url('system.theme_settings'))) . '</dd>';
|
||||
$output .= '</dl>';
|
||||
return $output;
|
||||
}
|
||||
if ($route_name == 'entity.menu.add_form' && \Drupal::moduleHandler()->moduleExists('block') && \Drupal::currentUser()->hasPermission('administer blocks')) {
|
||||
return '<p>' . t('You can enable the newly-created block for this menu on the <a href="!blocks">Block layout page</a>.', array('!blocks' => \Drupal::url('block.admin_display'))) . '</p>';
|
||||
return '<p>' . t('You can enable the newly-created block for this menu on the <a href=":blocks">Block layout page</a>.', array(':blocks' => \Drupal::url('block.admin_display'))) . '</p>';
|
||||
}
|
||||
elseif ($route_name == 'entity.menu.collection' && \Drupal::moduleHandler()->moduleExists('block') && \Drupal::currentUser()->hasPermission('administer blocks')) {
|
||||
return '<p>' . t('Each menu has a corresponding block that is managed on the <a href="!blocks">Block layout page</a>.', array('!blocks' => \Drupal::url('block.admin_display'))) . '</p>';
|
||||
return '<p>' . t('Each menu has a corresponding block that is managed on the <a href=":blocks">Block layout page</a>.', array(':blocks' => \Drupal::url('block.admin_display'))) . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ use Drupal\Core\Entity\EntityForm;
|
|||
use Drupal\Core\Entity\Query\QueryFactory;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\Core\Link;
|
||||
use Drupal\Core\Menu\MenuLinkManagerInterface;
|
||||
use Drupal\Core\Menu\MenuLinkTreeElement;
|
||||
use Drupal\Core\Menu\MenuLinkTreeInterface;
|
||||
|
@ -276,8 +277,8 @@ class MenuForm extends EntityForm {
|
|||
),
|
||||
);
|
||||
|
||||
$form['links']['#empty'] = $this->t('There are no menu links yet. <a href="@url">Add link</a>.', [
|
||||
'@url' => $this->url('entity.menu.add_link_form', ['menu' => $this->entity->id()], [
|
||||
$form['links']['#empty'] = $this->t('There are no menu links yet. <a href=":url">Add link</a>.', [
|
||||
':url' => $this->url('entity.menu.add_link_form', ['menu' => $this->entity->id()], [
|
||||
'query' => ['destination' => $this->entity->url('edit-form')],
|
||||
]),
|
||||
]);
|
||||
|
@ -353,12 +354,17 @@ class MenuForm extends EntityForm {
|
|||
$id = 'menu_plugin_id:' . $link->getPluginId();
|
||||
$form[$id]['#item'] = $element;
|
||||
$form[$id]['#attributes'] = $link->isEnabled() ? array('class' => array('menu-enabled')) : array('class' => array('menu-disabled'));
|
||||
$form[$id]['title']['#markup'] = $this->linkGenerator->generate($link->getTitle(), $link->getUrlObject());
|
||||
$form[$id]['title'] = Link::fromTextAndUrl($link->getTitle(), $link->getUrlObject())->toRenderable();
|
||||
if (!$link->isEnabled()) {
|
||||
$form[$id]['title']['#markup'] .= ' (' . $this->t('disabled') . ')';
|
||||
$form[$id]['title']['#suffix'] = ' (' . $this->t('disabled') . ')';
|
||||
}
|
||||
// @todo Remove this in https://www.drupal.org/node/2568785.
|
||||
elseif ($id === 'menu_plugin_id:user.logout') {
|
||||
$form[$id]['title']['#suffix'] = ' (' . $this->t('<q>Log in</q> for anonymous users') . ')';
|
||||
}
|
||||
// @todo Remove this in https://www.drupal.org/node/2568785.
|
||||
elseif (($url = $link->getUrlObject()) && $url->isRouted() && $url->getRouteName() == 'user.page') {
|
||||
$form[$id]['title']['#markup'] .= ' (' . $this->t('logged in users only') . ')';
|
||||
$form[$id]['title']['#suffix'] = ' (' . $this->t('logged in users only') . ')';
|
||||
}
|
||||
|
||||
$form[$id]['enabled'] = array(
|
||||
|
|
|
@ -35,6 +35,7 @@ class MenuNodeTest extends WebTestBase {
|
|||
parent::setUp();
|
||||
|
||||
$this->drupalPlaceBlock('system_menu_block:main');
|
||||
$this->drupalPlaceBlock('page_title_block');
|
||||
|
||||
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
|
||||
|
||||
|
|
|
@ -70,6 +70,8 @@ class MenuTest extends MenuWebTestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->drupalPlaceBlock('page_title_block');
|
||||
|
||||
$this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
|
||||
|
||||
// Create users.
|
||||
|
@ -195,8 +197,8 @@ class MenuTest extends MenuWebTestBase {
|
|||
|
||||
// Verify that using a menu_name that is too long results in a validation
|
||||
// message.
|
||||
$this->assertRaw(t('!name cannot be longer than %max characters but is currently %length characters long.', array(
|
||||
'!name' => t('Menu name'),
|
||||
$this->assertRaw(t('@name cannot be longer than %max characters but is currently %length characters long.', array(
|
||||
'@name' => t('Menu name'),
|
||||
'%max' => MENU_MAX_MENU_NAME_LENGTH_UI,
|
||||
'%length' => Unicode::strlen($menu_name),
|
||||
)));
|
||||
|
@ -207,8 +209,8 @@ class MenuTest extends MenuWebTestBase {
|
|||
$this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
|
||||
|
||||
// Verify that no validation error is given for menu_name length.
|
||||
$this->assertNoRaw(t('!name cannot be longer than %max characters but is currently %length characters long.', array(
|
||||
'!name' => t('Menu name'),
|
||||
$this->assertNoRaw(t('@name cannot be longer than %max characters but is currently %length characters long.', array(
|
||||
'@name' => t('Menu name'),
|
||||
'%max' => MENU_MAX_MENU_NAME_LENGTH_UI,
|
||||
'%length' => Unicode::strlen($menu_name),
|
||||
)));
|
||||
|
@ -891,8 +893,7 @@ class MenuTest extends MenuWebTestBase {
|
|||
// the front page.
|
||||
/** @var \Drupal\Core\Menu\MenuLinkManagerInterface $menu_link_manager */
|
||||
$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
|
||||
$result = $menu_link_manager->loadLinksByRoute('user.logout');
|
||||
$instance = reset($result);
|
||||
$instance = $menu_link_manager->getInstance(['id' => 'user.logout']);
|
||||
|
||||
$this->assertTrue((bool) $instance, 'Standard menu link was loaded');
|
||||
return $instance;
|
||||
|
|
Reference in a new issue