Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663

This commit is contained in:
Greg Anderson 2015-10-08 11:40:12 -07:00
parent eb34d130a8
commit f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions

View file

@ -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(

View file

@ -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'));

View file

@ -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;