Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023

This commit is contained in:
Pantheon Automation 2015-09-04 13:20:09 -07:00 committed by Greg Anderson
parent 2720a9ec4b
commit f3791f1da3
1898 changed files with 54300 additions and 11481 deletions

View file

@ -1,7 +1,7 @@
# Schema for configuration files of the Menu UI module.
menu_ui.settings:
type: mapping
type: config_object
label: 'Menu settings'
mapping:
override_parent_selector:

View file

@ -8,8 +8,12 @@
"use strict";
/**
* Set a summary on the menu link form.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Find the form and call `drupalSetSummary` on it.
*/
Drupal.behaviors.menuUiDetailsSummaries = {
attach: function (context) {
@ -29,14 +33,19 @@
* Automatically fill in a menu link title, if possible.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches change and keyup behavior for automatically filling out menu
* link titles.
*/
Drupal.behaviors.menuUiLinkAutomaticTitle = {
attach: function (context) {
var $context = $(context);
$context.find('.menu-link-form').each(function () {
var $this = $(this);
// 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.
// 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');
@ -44,8 +53,9 @@
if (!($checkbox.length && $link_title.length && $title.length)) {
return;
}
// If there is a link title already, mark it as overridden. The user expects
// that toggling the checkbox twice will take over the node's title.
// If there is a link title already, mark it as overridden. The user
// expects that toggling the checkbox twice will take over the node's
// title.
if ($checkbox.is(':checked') && $link_title.val().length) {
$link_title.data('menuLinkAutomaticTitleOverridden', true);
}

View file

@ -8,6 +8,7 @@
* used for navigation.
*/
use Drupal\Core\Breadcrumb\Breadcrumb;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Block\BlockPluginInterface;
@ -486,14 +487,14 @@ function menu_ui_preprocess_block(&$variables) {
/**
* Implements hook_system_breadcrumb_alter().
*/
function menu_ui_system_breadcrumb_alter(array &$breadcrumb, RouteMatchInterface $route_match, array $context) {
function menu_ui_system_breadcrumb_alter(Breadcrumb &$breadcrumb, RouteMatchInterface $route_match, array $context) {
// Custom breadcrumb behavior for editing menu links, we append a link to
// the menu in which the link is found.
if (($route_match->getRouteName() == 'menu_ui.link_edit') && $menu_link = $route_match->getParameter('menu_link_plugin')) {
if (($menu_link instanceof MenuLinkInterface)) {
// Add a link to the menu admin screen.
$menu = Menu::load($menu_link->getMenuName());
$breadcrumb[] = Link::createFromRoute($menu->label(), 'entity.menu.edit_form', array('menu' => $menu->id()));
$breadcrumb->addLink(Link::createFromRoute($menu->label(), 'entity.menu.edit_form', ['menu' => $menu->id()]));
}
}
}

View file

@ -0,0 +1,14 @@
id: menu_settings
label: Menu UI configuration
migration_tags:
- Drupal 6
- Drupal 7
source:
plugin: variable
variables:
- menu_override_parent_selector
process:
override_parent_selector: menu_override_parent_selector
destination:
plugin: config
config_name: menu_ui.settings

View file

@ -7,7 +7,7 @@
namespace Drupal\menu_ui\Controller;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Xss;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Menu\MenuParentFormSelectorInterface;
use Drupal\system\MenuInterface;
@ -73,11 +73,11 @@ class MenuController extends ControllerBase {
* @param \Drupal\system\MenuInterface $menu
* The menu entity.
*
* @return string
* The menu label.
* @return array
* The menu label as a render array.
*/
public function menuTitle(MenuInterface $menu) {
return SafeMarkup::xssFilter($menu->label());
return ['#markup' => $menu->label(), '#allowed_tags' => Xss::getHtmlTagList()];
}
}

View file

@ -36,7 +36,7 @@ class MenuListBuilder extends ConfigEntityListBuilder {
*/
public function buildRow(EntityInterface $entity) {
$row['title'] = array(
'data' => $this->getLabel($entity),
'data' => $entity->label(),
'class' => array('menu-label'),
);
$row['description']['data'] = ['#markup' => $entity->getDescription()];

View file

@ -0,0 +1,71 @@
<?php
/**
* @file
* Contains \Drupal\menu_ui\Tests\MenuLinkReorderTest.
*/
namespace Drupal\menu_ui\Tests;
use Drupal\simpletest\WebTestBase;
/**
* Reorder menu items.
*
* @group menu_ui
*/
class MenuLinkReorderTest extends WebTestBase {
/**
* An administrator user.
*
* @var \Drupal\user\UserInterface
*/
protected $administrator;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('menu_ui', 'test_page_test', 'node', 'block');
/**
* Test creating, editing, deleting menu links via node form widget.
*/
function testDefaultMenuLinkReorder() {
// Add the main menu block.
$this->drupalPlaceBlock('system_menu_block:main');
// Assert that the Home link is available.
$this->drupalGet('test-page');
$this->assertLink('Home');
// The administrator user that can re-order menu links.
$this->administrator = $this->drupalCreateUser(array(
'administer site configuration',
'access administration pages',
'administer menu',
));
$this->drupalLogin($this->administrator);
// Change the weight of the link to a non default value.
$edit = array(
'links[menu_plugin_id:test_page_test.front_page][weight]' => -10,
);
$this->drupalPostForm('admin/structure/menu/manage/main', $edit, t('Save'));
// The link is still there.
$this->drupalGet('test-page');
$this->assertLink('Home');
// Clear all caches.
$this->drupalPostForm('admin/config/development/performance', [], t('Clear all caches'));
// Clearing all caches should not affect the state of the menu link.
$this->drupalGet('test-page');
$this->assertLink('Home');
}
}

View file

@ -139,7 +139,7 @@ class MenuNodeTest extends WebTestBase {
'edit any page content',
]);
$this->drupalLogin($admin_user);
foreach ([t('Save and unpublish') => FALSE, t('Save and keep unpublished') => FALSE, t('Save and publish') => TRUE, t('Save and keep published') => TRUE] as $submit => $visible) {
foreach (['Save and unpublish' => FALSE, 'Save and keep unpublished' => FALSE, 'Save and publish' => TRUE, 'Save and keep published' => TRUE] as $submit => $visible) {
$edit = [
'menu[enabled]' => 1,
'menu[title]' => $node_title,

View file

@ -243,9 +243,10 @@ class MenuTest extends MenuWebTestBase {
$this->assertResponse(200);
$this->assertRaw(t('The menu %title has been deleted.', array('%title' => $label)), 'Custom menu was deleted');
$this->assertNull(Menu::load($menu_name), 'Custom menu was deleted');
// Test if all menu links associated to the menu were removed from database.
// Test if all menu links associated with the menu were removed from
// database.
$result = entity_load_multiple_by_properties('menu_link_content', array('menu_name' => $menu_name));
$this->assertFalse($result, 'All menu links associated to the custom menu were deleted.');
$this->assertFalse($result, 'All menu links associated with the custom menu were deleted.');
// Make sure there's no delete button on system menus.
$this->drupalGet('admin/structure/menu/manage/main');

View file

@ -0,0 +1,34 @@
<?php
/**
* @file
* Contains \Drupal\menu_ui\Tests\Migrate\MigrateMenuSettingsTest.
*/
namespace Drupal\menu_ui\Tests\Migrate;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
/**
* Tests migration of menu_ui settings.
*
* @group menu_ui
*/
class MigrateMenuSettingsTest extends MigrateDrupal7TestBase {
public static $modules = ['menu_ui'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installConfig(['menu_ui']);
$this->executeMigration('menu_settings');
}
public function testMigration() {
$this->assertTrue(\Drupal::config('menu_ui.settings')->get('override_parent_selector'));
}
}