Issue #2085243 by dawehner: Rename Menu module into Menu UI module.
parent
62ba47d26a
commit
e562ca4dd3
|
|
@ -422,8 +422,8 @@ function menu_secondary_menu() {
|
||||||
* Returns menu name, if exist
|
* Returns menu name, if exist
|
||||||
*/
|
*/
|
||||||
function _menu_get_links_source($name, $default) {
|
function _menu_get_links_source($name, $default) {
|
||||||
$config = \Drupal::config('menu.settings');
|
$config = \Drupal::config('menu_ui.settings');
|
||||||
return \Drupal::moduleHandler()->moduleExists('menu') ? $config->get($name) : $default;
|
return \Drupal::moduleHandler()->moduleExists('menu_ui') ? $config->get($name) : $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class BlockLanguageCacheTest extends WebTestBase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $modules = array('block', 'language', 'menu');
|
public static $modules = array('block', 'language', 'menu_ui');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of langcodes.
|
* List of langcodes.
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class ConfigTranslationListUiTest extends WebTestBase {
|
||||||
'custom_block',
|
'custom_block',
|
||||||
'field',
|
'field',
|
||||||
'field_ui',
|
'field_ui',
|
||||||
'menu',
|
'menu_ui',
|
||||||
'node',
|
'node',
|
||||||
'shortcut',
|
'shortcut',
|
||||||
'taxonomy',
|
'taxonomy',
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class ForumTest extends WebTestBase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $modules = array('taxonomy', 'comment', 'forum', 'node', 'block', 'menu', 'help');
|
public static $modules = array('taxonomy', 'comment', 'forum', 'node', 'block', 'menu_ui', 'help');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A user with various administrative privileges.
|
* A user with various administrative privileges.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
menu_edit:
|
|
||||||
title: 'Edit menu'
|
|
||||||
route_name: 'menu.menu_edit'
|
|
||||||
group: menu
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
menu_link_add:
|
|
||||||
route_name: menu.link_add
|
|
||||||
title: 'Add link'
|
|
||||||
appears_on:
|
|
||||||
- menu.menu_edit
|
|
||||||
|
|
||||||
menu.menu_add:
|
|
||||||
route_name: menu.menu_add
|
|
||||||
title: 'Add menu'
|
|
||||||
appears_on:
|
|
||||||
- menu.overview_page
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
menu.menu_edit:
|
|
||||||
title: 'Edit menu'
|
|
||||||
route_name: menu.menu_edit
|
|
||||||
base_route: menu.menu_edit
|
|
||||||
|
|
||||||
menu.overview_page:
|
|
||||||
title: 'List'
|
|
||||||
route_name: menu.overview_page
|
|
||||||
base_route: menu.overview_page
|
|
||||||
|
|
||||||
menu.settings:
|
|
||||||
title: 'Settings'
|
|
||||||
route_name: menu.settings
|
|
||||||
base_route: menu.overview_page
|
|
||||||
weight: 100
|
|
||||||
|
|
@ -111,7 +111,7 @@ class MenuLink extends Entity implements \ArrayAccess, MenuLinkInterface {
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $module = 'menu';
|
public $module = 'menu_ui';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag for whether the link should be rendered in menus.
|
* A flag for whether the link should be rendered in menus.
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class MenuLinkAccessController extends EntityAccessController {
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
// Only items created by the menu module can be deleted.
|
// Only items created by the menu module can be deleted.
|
||||||
return $entity->module == 'menu' || $entity->updated == 1;
|
return $entity->module == 'menu_ui' || $entity->updated == 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ class MenuLinkFormController extends EntityFormController {
|
||||||
if (isset($menu_link->options['fragment'])) {
|
if (isset($menu_link->options['fragment'])) {
|
||||||
$path .= '#' . $menu_link->options['fragment'];
|
$path .= '#' . $menu_link->options['fragment'];
|
||||||
}
|
}
|
||||||
if ($menu_link->module == 'menu') {
|
if ($menu_link->module == 'menu_ui') {
|
||||||
$form['link_path'] = array(
|
$form['link_path'] = array(
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => t('Path'),
|
'#title' => t('Path'),
|
||||||
|
|
@ -137,7 +137,7 @@ class MenuLinkFormController extends EntityFormController {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Generate a list of possible parents (not including this link or descendants).
|
// Generate a list of possible parents (not including this link or descendants).
|
||||||
$options = menu_parent_options(menu_get_menus(), $menu_link);
|
$options = menu_ui_parent_options(menu_ui_get_menus(), $menu_link);
|
||||||
$default = $menu_link->menu_name . ':' . $menu_link->plid;
|
$default = $menu_link->menu_name . ':' . $menu_link->plid;
|
||||||
if (!isset($options[$default])) {
|
if (!isset($options[$default])) {
|
||||||
$default = 'tools:0';
|
$default = 'tools:0';
|
||||||
|
|
@ -298,7 +298,7 @@ class MenuLinkFormController extends EntityFormController {
|
||||||
if ($saved) {
|
if ($saved) {
|
||||||
drupal_set_message(t('The menu link has been saved.'));
|
drupal_set_message(t('The menu link has been saved.'));
|
||||||
$form_state['redirect_route'] = array(
|
$form_state['redirect_route'] = array(
|
||||||
'route_name' => 'menu.menu_edit',
|
'route_name' => 'menu_ui.menu_edit',
|
||||||
'route_parameters' => array(
|
'route_parameters' => array(
|
||||||
'menu' => $menu_link->menu_name,
|
'menu' => $menu_link->menu_name,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ function menu_link_help($path, $arg) {
|
||||||
case 'admin/help#menu_link':
|
case 'admin/help#menu_link':
|
||||||
$output = '';
|
$output = '';
|
||||||
$output .= '<h3>' . t('About') . '</h3>';
|
$output .= '<h3>' . t('About') . '</h3>';
|
||||||
$output .= '<p>' . t('The Menu Link module allows users to create menu links. It is required by the Menu module, which provides an interface for managing menus. See the <a href="!menu-help">Menu module help page</a> for more information.', array('!menu-help' => \Drupal::url('help.page', array('name' => 'menu')))) . '</p>';
|
$output .= '<p>' . t('The Menu Link module allows users to create menu links. It is required by the Menu module, which provides an interface for managing menus. See the <a href="!menu-help">Menu module help page</a> for more information.', array('!menu-help' => \Drupal::url('help.page', array('name' => 'menu_ui')))) . '</p>';
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -203,12 +203,12 @@ function menu_link_maintain($module, $op, $link_path, $link_title = NULL) {
|
||||||
function menu_link_system_breadcrumb_alter(array &$breadcrumb, array $attributes, array $context) {
|
function menu_link_system_breadcrumb_alter(array &$breadcrumb, array $attributes, array $context) {
|
||||||
// Custom breadcrumb behavior for editing menu links, we append a link to
|
// Custom breadcrumb behavior for editing menu links, we append a link to
|
||||||
// the menu in which the link is found.
|
// the menu in which the link is found.
|
||||||
if (!empty($attributes[RouteObjectInterface::ROUTE_NAME]) && $attributes[RouteObjectInterface::ROUTE_NAME] == 'menu.link_edit' && !empty($attributes['menu_link'])) {
|
if (!empty($attributes[RouteObjectInterface::ROUTE_NAME]) && $attributes[RouteObjectInterface::ROUTE_NAME] == 'menu_ui.link_edit' && !empty($attributes['menu_link'])) {
|
||||||
$menu_link = $attributes['menu_link'];
|
$menu_link = $attributes['menu_link'];
|
||||||
if (($menu_link instanceof MenuLinkInterface) && !$menu_link->isNew()) {
|
if (($menu_link instanceof MenuLinkInterface) && !$menu_link->isNew()) {
|
||||||
// Add a link to the menu admin screen.
|
// Add a link to the menu admin screen.
|
||||||
$menu = entity_load('menu', $menu_link->menu_name);
|
$menu = entity_load('menu', $menu_link->menu_name);
|
||||||
$breadcrumb[] = Drupal::l($menu->label(), 'menu.menu_edit', array('menu' => $menu->id));
|
$breadcrumb[] = Drupal::l($menu->label(), 'menu_ui.menu_edit', array('menu' => $menu->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Schema for configuration files of the Menu module.
|
# Schema for configuration files of the Menu module.
|
||||||
|
|
||||||
menu.settings:
|
menu_ui.settings:
|
||||||
type: mapping
|
type: mapping
|
||||||
label: 'Menu settings'
|
label: 'Menu settings'
|
||||||
mapping:
|
mapping:
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Contains \Drupal\menu\Controller\MenuController.
|
* Contains \Drupal\menu_ui\Controller\MenuController.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\menu\Controller;
|
namespace Drupal\menu_ui\Controller;
|
||||||
|
|
||||||
use Drupal\Component\Utility\Xss;
|
use Drupal\Component\Utility\Xss;
|
||||||
use Drupal\Core\Controller\ControllerBase;
|
use Drupal\Core\Controller\ControllerBase;
|
||||||
|
|
@ -34,7 +34,7 @@ class MenuController extends ControllerBase {
|
||||||
$available_menus[$menu] = $menu;
|
$available_menus[$menu] = $menu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$options = _menu_get_options(menu_get_menus(), $available_menus, array('mlid' => 0));
|
$options = _menu_ui_get_options(menu_ui_get_menus(), $available_menus, array('mlid' => 0));
|
||||||
|
|
||||||
return new JsonResponse($options);
|
return new JsonResponse($options);
|
||||||
}
|
}
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Contains \Drupal\menu\Form\MenuDeleteForm.
|
* Contains \Drupal\menu_ui\Form\MenuDeleteForm.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\menu\Form;
|
namespace Drupal\menu_ui\Form;
|
||||||
|
|
||||||
use Drupal\Core\Database\Connection;
|
use Drupal\Core\Database\Connection;
|
||||||
use Drupal\Core\Entity\EntityConfirmFormBase;
|
use Drupal\Core\Entity\EntityConfirmFormBase;
|
||||||
|
|
@ -66,7 +66,7 @@ class MenuDeleteForm extends EntityConfirmFormBase {
|
||||||
*/
|
*/
|
||||||
public function getCancelRoute() {
|
public function getCancelRoute() {
|
||||||
return array(
|
return array(
|
||||||
'route_name' => 'menu.menu_edit',
|
'route_name' => 'menu_ui.menu_edit',
|
||||||
'route_parameters' => array(
|
'route_parameters' => array(
|
||||||
'menu' => $this->entity->id(),
|
'menu' => $this->entity->id(),
|
||||||
),
|
),
|
||||||
|
|
@ -97,7 +97,7 @@ class MenuDeleteForm extends EntityConfirmFormBase {
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function submit(array $form, array &$form_state) {
|
public function submit(array $form, array &$form_state) {
|
||||||
$form_state['redirect_route']['route_name'] = 'menu.overview_page';
|
$form_state['redirect_route']['route_name'] = 'menu_ui.overview_page';
|
||||||
|
|
||||||
// Locked menus may not be deleted.
|
// Locked menus may not be deleted.
|
||||||
if ($this->entity->isLocked()) {
|
if ($this->entity->isLocked()) {
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Contains \Drupal\menu\Form\MenuLinkDeleteForm.
|
* Contains \Drupal\menu_ui\Form\MenuLinkDeleteForm.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\menu\Form;
|
namespace Drupal\menu_ui\Form;
|
||||||
|
|
||||||
use Drupal\Core\Entity\EntityConfirmFormBase;
|
use Drupal\Core\Entity\EntityConfirmFormBase;
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ class MenuLinkDeleteForm extends EntityConfirmFormBase {
|
||||||
*/
|
*/
|
||||||
public function getCancelRoute() {
|
public function getCancelRoute() {
|
||||||
return array(
|
return array(
|
||||||
'route_name' => 'menu.menu_edit',
|
'route_name' => 'menu_ui.menu_edit',
|
||||||
'route_parameters' => array(
|
'route_parameters' => array(
|
||||||
'menu' => $this->entity->menu_name,
|
'menu' => $this->entity->menu_name,
|
||||||
),
|
),
|
||||||
|
|
@ -42,7 +42,7 @@ class MenuLinkDeleteForm extends EntityConfirmFormBase {
|
||||||
drupal_set_message(t('The menu link %title has been deleted.', $t_args));
|
drupal_set_message(t('The menu link %title has been deleted.', $t_args));
|
||||||
watchdog('menu', 'Deleted menu link %title.', $t_args, WATCHDOG_NOTICE);
|
watchdog('menu', 'Deleted menu link %title.', $t_args, WATCHDOG_NOTICE);
|
||||||
$form_state['redirect_route'] = array(
|
$form_state['redirect_route'] = array(
|
||||||
'route_name' => 'menu.menu_edit',
|
'route_name' => 'menu_ui.menu_edit',
|
||||||
'route_parameters' => array(
|
'route_parameters' => array(
|
||||||
'menu' => $this->entity->menu_name,
|
'menu' => $this->entity->menu_name,
|
||||||
),
|
),
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Contains \Drupal\menu\Form\MenuLinkResetForm.
|
* Contains \Drupal\menu_ui\Form\MenuLinkResetForm.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\menu\Form;
|
namespace Drupal\menu_ui\Form;
|
||||||
|
|
||||||
use Drupal\Core\Entity\EntityConfirmFormBase;
|
use Drupal\Core\Entity\EntityConfirmFormBase;
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ class MenuLinkResetForm extends EntityConfirmFormBase {
|
||||||
*/
|
*/
|
||||||
public function getCancelRoute() {
|
public function getCancelRoute() {
|
||||||
return array(
|
return array(
|
||||||
'route_name' => 'menu.menu_edit',
|
'route_name' => 'menu_ui.menu_edit',
|
||||||
'route_parameters' => array(
|
'route_parameters' => array(
|
||||||
'menu' => $this->entity->menu_name,
|
'menu' => $this->entity->menu_name,
|
||||||
),
|
),
|
||||||
|
|
@ -54,7 +54,7 @@ class MenuLinkResetForm extends EntityConfirmFormBase {
|
||||||
$new_menu_link = $this->entity->reset();
|
$new_menu_link = $this->entity->reset();
|
||||||
drupal_set_message(t('The menu link was reset to its default settings.'));
|
drupal_set_message(t('The menu link was reset to its default settings.'));
|
||||||
$form_state['redirect_route'] = array(
|
$form_state['redirect_route'] = array(
|
||||||
'route_name' => 'menu.menu_edit',
|
'route_name' => 'menu_ui.menu_edit',
|
||||||
'route_parameters' => array(
|
'route_parameters' => array(
|
||||||
'menu' => $new_menu_link->menu_name,
|
'menu' => $new_menu_link->menu_name,
|
||||||
),
|
),
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Contains \Drupal\menu\MenuFormController.
|
* Contains \Drupal\menu_ui\MenuFormController.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\menu;
|
namespace Drupal\menu_ui;
|
||||||
|
|
||||||
use Drupal\Component\Utility\NestedArray;
|
use Drupal\Component\Utility\NestedArray;
|
||||||
use Drupal\Core\Entity\EntityFormController;
|
use Drupal\Core\Entity\EntityFormController;
|
||||||
|
|
@ -240,7 +240,7 @@ class MenuFormController extends EntityFormController {
|
||||||
*
|
*
|
||||||
* This form constructor can be integrated as a section into another form. It
|
* This form constructor can be integrated as a section into another form. It
|
||||||
* relies on the following keys in $form_state:
|
* relies on the following keys in $form_state:
|
||||||
* - menu: A loaded menu definition, as returned by menu_load().
|
* - menu: A loaded menu definition, as returned by menu_ui_load().
|
||||||
* - menu_overview_form_parents: An array containing the parent keys to this
|
* - menu_overview_form_parents: An array containing the parent keys to this
|
||||||
* form.
|
* form.
|
||||||
* Forms integrating this section should call menu_overview_form_submit() from
|
* Forms integrating this section should call menu_overview_form_submit() from
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Contains \Drupal\menu\MenuListBuilder.
|
* Contains \Drupal\menu_ui\MenuListBuilder.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\menu;
|
namespace Drupal\menu_ui;
|
||||||
|
|
||||||
use Drupal\Component\Utility\Xss;
|
use Drupal\Component\Utility\Xss;
|
||||||
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Contains \Drupal\menu\MenuSettingsForm.
|
* Contains \Drupal\menu_ui\MenuSettingsForm.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\menu;
|
namespace Drupal\menu_ui;
|
||||||
|
|
||||||
use Drupal\Core\Form\ConfigFormBase;
|
use Drupal\Core\Form\ConfigFormBase;
|
||||||
|
|
||||||
|
|
@ -25,13 +25,13 @@ class MenuSettingsForm extends ConfigFormBase {
|
||||||
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
* Implements \Drupal\Core\Form\FormInterface::buildForm().
|
||||||
*/
|
*/
|
||||||
public function buildForm(array $form, array &$form_state) {
|
public function buildForm(array $form, array &$form_state) {
|
||||||
$config = $this->configFactory->get('menu.settings');
|
$config = $this->configFactory->get('menu_ui.settings');
|
||||||
$form['intro'] = array(
|
$form['intro'] = array(
|
||||||
'#type' => 'item',
|
'#type' => 'item',
|
||||||
'#markup' => t('The menu module allows on-the-fly creation of menu links in the content authoring forms. To configure these settings for a particular content type, visit the <a href="@content-types">Content types</a> page, click the <em>edit</em> link for the content type, and go to the <em>Menu settings</em> section.', array('@content-types' => url('admin/structure/types'))),
|
'#markup' => t('The menu module allows on-the-fly creation of menu links in the content authoring forms. To configure these settings for a particular content type, visit the <a href="@content-types">Content types</a> page, click the <em>edit</em> link for the content type, and go to the <em>Menu settings</em> section.', array('@content-types' => url('admin/structure/types'))),
|
||||||
);
|
);
|
||||||
|
|
||||||
$menu_options = menu_get_menus();
|
$menu_options = menu_ui_get_menus();
|
||||||
|
|
||||||
$main = $config->get('main_links');
|
$main = $config->get('main_links');
|
||||||
$form['menu_main_links_source'] = array(
|
$form['menu_main_links_source'] = array(
|
||||||
|
|
@ -61,7 +61,7 @@ class MenuSettingsForm extends ConfigFormBase {
|
||||||
* Implements \Drupal\Core\Form\FormInterface::submitForm().
|
* Implements \Drupal\Core\Form\FormInterface::submitForm().
|
||||||
*/
|
*/
|
||||||
public function submitForm(array &$form, array &$form_state) {
|
public function submitForm(array &$form, array &$form_state) {
|
||||||
$this->configFactory->get('menu.settings')
|
$this->configFactory->get('menu_ui.settings')
|
||||||
->set('main_links', $form_state['values']['menu_main_links_source'])
|
->set('main_links', $form_state['values']['menu_main_links_source'])
|
||||||
->set('secondary_links', $form_state['values']['menu_secondary_links_source'])
|
->set('secondary_links', $form_state['values']['menu_secondary_links_source'])
|
||||||
->save();
|
->save();
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
* Contains \Drupal\menu\Tests\MenuCacheTagsTest.
|
* Contains \Drupal\menu\Tests\MenuCacheTagsTest.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\menu\Tests;
|
namespace Drupal\menu_ui\Tests;
|
||||||
|
|
||||||
use Drupal\system\Tests\Cache\PageCacheTagsTestBase;
|
use Drupal\system\Tests\Cache\PageCacheTagsTestBase;
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ class MenuCacheTagsTest extends PageCacheTagsTestBase {
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static $modules = array('menu', 'block', 'test_page_test');
|
public static $modules = array('menu_ui', 'block', 'test_page_test');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Tests for menu language settings.
|
* Tests for menu_ui language settings.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\menu\Tests;
|
namespace Drupal\menu_ui\Tests;
|
||||||
|
|
||||||
use Drupal\Component\Utility\Unicode;
|
use Drupal\Component\Utility\Unicode;
|
||||||
use Drupal\Core\Language\Language;
|
use Drupal\Core\Language\Language;
|
||||||
|
|
@ -174,7 +174,7 @@ class MenuLanguageTest extends MenuWebTestBase {
|
||||||
$this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
|
$this->drupalPostForm('admin/structure/menu/add', $edit, t('Save'));
|
||||||
|
|
||||||
// Check that the language settings were saved.
|
// Check that the language settings were saved.
|
||||||
$menu = menu_load($menu_name);
|
$menu = menu_ui_load($menu_name);
|
||||||
$this->assertEqual($menu->langcode, 'en');
|
$this->assertEqual($menu->langcode, 'en');
|
||||||
|
|
||||||
// Remove English language. To do that another language has to be set as
|
// Remove English language. To do that another language has to be set as
|
||||||
|
|
@ -186,7 +186,7 @@ class MenuLanguageTest extends MenuWebTestBase {
|
||||||
|
|
||||||
// Save the menu again and check if the language is still the same.
|
// Save the menu again and check if the language is still the same.
|
||||||
$this->drupalPostForm("admin/structure/menu/manage/$menu_name", array(), t('Save'));
|
$this->drupalPostForm("admin/structure/menu/manage/$menu_name", array(), t('Save'));
|
||||||
$menu = menu_load($menu_name);
|
$menu = menu_ui_load($menu_name);
|
||||||
$this->assertEqual($menu->langcode, 'en');
|
$this->assertEqual($menu->langcode, 'en');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Definition of Drupal\menu\Tests\MenuNodeTest.
|
* Definition of Drupal\menu_ui\Tests\MenuNodeTest.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\menu\Tests;
|
namespace Drupal\menu_ui\Tests;
|
||||||
|
|
||||||
use Drupal\simpletest\WebTestBase;
|
use Drupal\simpletest\WebTestBase;
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ class MenuNodeTest extends WebTestBase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $modules = array('menu', 'test_page_test', 'node');
|
public static $modules = array('menu_ui', 'test_page_test', 'node');
|
||||||
|
|
||||||
public static function getInfo() {
|
public static function getInfo() {
|
||||||
return array(
|
return array(
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Definition of Drupal\menu\Tests\MenuTest.
|
* Definition of Drupal\menu_ui\Tests\MenuTest.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\menu\Tests;
|
namespace Drupal\menu_ui\Tests;
|
||||||
|
|
||||||
use Drupal\Component\Utility\Json;
|
use Drupal\Component\Utility\Json;
|
||||||
|
|
||||||
|
|
@ -199,7 +199,7 @@ class MenuTest extends MenuWebTestBase {
|
||||||
|
|
||||||
// Enable the block.
|
// Enable the block.
|
||||||
$this->drupalPlaceBlock('system_menu_block:' . $menu_name);
|
$this->drupalPlaceBlock('system_menu_block:' . $menu_name);
|
||||||
return menu_load($menu_name);
|
return menu_ui_load($menu_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -216,7 +216,7 @@ class MenuTest extends MenuWebTestBase {
|
||||||
$this->drupalPostForm("admin/structure/menu/manage/$menu_name/delete", array(), t('Delete'));
|
$this->drupalPostForm("admin/structure/menu/manage/$menu_name/delete", array(), t('Delete'));
|
||||||
$this->assertResponse(200);
|
$this->assertResponse(200);
|
||||||
$this->assertRaw(t('The custom menu %title has been deleted.', array('%title' => $label)), 'Custom menu was deleted');
|
$this->assertRaw(t('The custom menu %title has been deleted.', array('%title' => $label)), 'Custom menu was deleted');
|
||||||
$this->assertFalse(menu_load($menu_name), 'Custom menu was deleted');
|
$this->assertFalse(menu_ui_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 to the menu were removed from database.
|
||||||
$result = entity_load_multiple_by_properties('menu_link', array('menu_name' => $menu_name));
|
$result = entity_load_multiple_by_properties('menu_link', 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 to the custom menu were deleted.');
|
||||||
|
|
@ -477,7 +477,7 @@ class MenuTest extends MenuWebTestBase {
|
||||||
$response = $this->drupalPost('contextual/render', 'application/json', $post, array('query' => array('destination' => 'test-page')));
|
$response = $this->drupalPost('contextual/render', 'application/json', $post, array('query' => array('destination' => 'test-page')));
|
||||||
$this->assertResponse(200);
|
$this->assertResponse(200);
|
||||||
$json = Json::decode($response);
|
$json = Json::decode($response);
|
||||||
$this->assertIdentical($json[$id], '<ul class="contextual-links"><li class="block-configure"><a href="' . base_path() . 'admin/structure/block/manage/' . $block->id() . '">Configure block</a></li><li class="menu-edit"><a href="' . base_path() . 'admin/structure/menu/manage/tools">Edit menu</a></li></ul>');
|
$this->assertIdentical($json[$id], '<ul class="contextual-links"><li class="block-configure"><a href="' . base_path() . 'admin/structure/block/manage/' . $block->id() . '">Configure block</a></li><li class="menu-ui-edit"><a href="' . base_path() . 'admin/structure/menu/manage/tools">Edit menu</a></li></ul>');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Contains \Drupal\menu\Tests\MenuUninstallTest.
|
* Contains \Drupal\menu_ui\Tests\MenuUninstallTest.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\menu\Tests;
|
namespace Drupal\menu_ui\Tests;
|
||||||
|
|
||||||
use Drupal\simpletest\WebTestBase;
|
use Drupal\simpletest\WebTestBase;
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ class MenuUninstallTest extends WebTestBase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $modules = array('menu');
|
public static $modules = array('menu_ui');
|
||||||
|
|
||||||
public static function getInfo() {
|
public static function getInfo() {
|
||||||
return array(
|
return array(
|
||||||
|
|
@ -33,7 +33,7 @@ class MenuUninstallTest extends WebTestBase {
|
||||||
* Tests Menu uninstall.
|
* Tests Menu uninstall.
|
||||||
*/
|
*/
|
||||||
public function testMenuUninstall() {
|
public function testMenuUninstall() {
|
||||||
\Drupal::moduleHandler()->uninstall(array('menu'));
|
\Drupal::moduleHandler()->uninstall(array('menu_ui'));
|
||||||
|
|
||||||
$this->assertTrue(entity_load('menu', 'admin', TRUE), 'The \'admin\' menu still exists after uninstalling menu module.');
|
$this->assertTrue(entity_load('menu', 'admin', TRUE), 'The \'admin\' menu still exists after uninstalling menu module.');
|
||||||
}
|
}
|
||||||
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Contains \Drupal\menu\Tests\MenuWebTestBase.
|
* Contains \Drupal\menu_ui\Tests\MenuWebTestBase.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Drupal\menu\Tests;
|
namespace Drupal\menu_ui\Tests;
|
||||||
|
|
||||||
use Drupal\simpletest\WebTestBase;
|
use Drupal\simpletest\WebTestBase;
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ class MenuWebTestBase extends WebTestBase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $modules = array('menu');
|
public static $modules = array('menu_ui');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetchs the menu item from the database and compares it to expected item.
|
* Fetchs the menu item from the database and compares it to expected item.
|
||||||
|
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Drupal.behaviors.menuChangeParentItems = {
|
Drupal.behaviors.menuUiChangeParentItems = {
|
||||||
attach: function (context, settings) {
|
attach: function (context, settings) {
|
||||||
var $menu = $('#edit-menu');
|
var $menu = $('#edit-menu');
|
||||||
$menu.once('menu-parent', function () {
|
$menu.once('menu-parent', function () {
|
||||||
// Update the list of available parent menu items to match the initial
|
// Update the list of available parent menu items to match the initial
|
||||||
// available menus.
|
// available menus.
|
||||||
Drupal.menuUpdateParentList();
|
Drupal.menuUiUpdateParentList();
|
||||||
|
|
||||||
// Update list of available parent menu items.
|
// Update list of available parent menu items.
|
||||||
$menu.on('change', 'input', Drupal.menuUpdateParentList);
|
$menu.on('change', 'input', Drupal.menuUiUpdateParentList);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
/**
|
/**
|
||||||
* Function to set the options of the menu parent item dropdown.
|
* Function to set the options of the menu parent item dropdown.
|
||||||
*/
|
*/
|
||||||
Drupal.menuUpdateParentList = function () {
|
Drupal.menuUiUpdateParentList = function () {
|
||||||
var $menu = $('#edit-menu');
|
var $menu = $('#edit-menu');
|
||||||
var values = [];
|
var values = [];
|
||||||
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
menu_ui_edit:
|
||||||
|
title: 'Edit menu'
|
||||||
|
route_name: 'menu_ui.menu_edit'
|
||||||
|
group: menu
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
name: Menu
|
name: Menu Ui
|
||||||
type: module
|
type: module
|
||||||
description: 'Allows administrators to customize the site navigation menu.'
|
description: 'Allows administrators to customize the site navigation menu.'
|
||||||
package: Core
|
package: Core
|
||||||
version: VERSION
|
version: VERSION
|
||||||
core: 8.x
|
core: 8.x
|
||||||
configure: menu.overview_page
|
configure: menu_ui.overview_page
|
||||||
dependencies:
|
dependencies:
|
||||||
- menu_link
|
- menu_link
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Install, update and uninstall functions for the menu module.
|
* Install, update and uninstall functions for the menu_ui module.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Drupal\Component\Uuid\Uuid;
|
use Drupal\Component\Uuid\Uuid;
|
||||||
|
|
@ -10,7 +10,7 @@ use Drupal\Component\Uuid\Uuid;
|
||||||
/**
|
/**
|
||||||
* Implements hook_install().
|
* Implements hook_install().
|
||||||
*/
|
*/
|
||||||
function menu_install() {
|
function menu_ui_install() {
|
||||||
// Rebuild all the menu data.
|
// Rebuild all the menu data.
|
||||||
// @todo - remove this when we understand why removing it breaks the
|
// @todo - remove this when we understand why removing it breaks the
|
||||||
// standard install profile, possibly need to be handled in
|
// standard install profile, possibly need to be handled in
|
||||||
|
|
@ -31,6 +31,6 @@ function menu_install() {
|
||||||
/**
|
/**
|
||||||
* Implements hook_uninstall().
|
* Implements hook_uninstall().
|
||||||
*/
|
*/
|
||||||
function menu_uninstall() {
|
function menu_ui_uninstall() {
|
||||||
\Drupal::service('router.builder')->setRebuildNeeded();
|
\Drupal::service('router.builder')->setRebuildNeeded();
|
||||||
}
|
}
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Drupal.behaviors.menuDetailsSummaries = {
|
Drupal.behaviors.menuUiDetailsSummaries = {
|
||||||
attach: function (context) {
|
attach: function (context) {
|
||||||
$(context).find('.menu-link-form').drupalSetSummary(function (context) {
|
$(context).find('.menu-link-form').drupalSetSummary(function (context) {
|
||||||
var $context = $(context);
|
var $context = $(context);
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
/**
|
/**
|
||||||
* Automatically fill in a menu link title, if possible.
|
* Automatically fill in a menu link title, if possible.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.menuLinkAutomaticTitle = {
|
Drupal.behaviors.menuUiLinkAutomaticTitle = {
|
||||||
attach: function (context) {
|
attach: function (context) {
|
||||||
var $context = $(context);
|
var $context = $(context);
|
||||||
$context.find('.menu-link-form').each(function () {
|
$context.find('.menu-link-form').each(function () {
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
drupal.menu:
|
drupal.menu_ui:
|
||||||
version: VERSION
|
version: VERSION
|
||||||
js:
|
js:
|
||||||
menu.js: {}
|
menu_ui.js: {}
|
||||||
dependencies:
|
dependencies:
|
||||||
- core/jquery
|
- core/jquery
|
||||||
- core/drupal
|
- core/drupal
|
||||||
- core/drupal.form
|
- core/drupal.form
|
||||||
|
|
||||||
drupal.menu.admin:
|
drupal.menu_ui.admin:
|
||||||
version: VERSION
|
version: VERSION
|
||||||
js:
|
js:
|
||||||
menu.admin.js: {}
|
menu_ui.admin.js: {}
|
||||||
dependencies:
|
dependencies:
|
||||||
- core/jquery
|
- core/jquery
|
||||||
- core/drupal
|
- core/drupal
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
menu_ui_link_add:
|
||||||
|
route_name: menu_ui.link_add
|
||||||
|
title: 'Add link'
|
||||||
|
appears_on:
|
||||||
|
- menu_ui.menu_edit
|
||||||
|
|
||||||
|
menu_ui.menu_add:
|
||||||
|
route_name: menu_ui.menu_add
|
||||||
|
title: 'Add menu'
|
||||||
|
appears_on:
|
||||||
|
- menu_ui.overview_page
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
menu_ui.menu_edit:
|
||||||
|
title: 'Edit menu'
|
||||||
|
route_name: menu_ui.menu_edit
|
||||||
|
base_route: menu_ui.menu_edit
|
||||||
|
|
||||||
|
menu_ui.overview_page:
|
||||||
|
title: 'List'
|
||||||
|
route_name: menu_ui.overview_page
|
||||||
|
base_route: menu_ui.overview_page
|
||||||
|
|
||||||
|
menu_ui.settings:
|
||||||
|
title: 'Settings'
|
||||||
|
route_name: menu_ui.settings
|
||||||
|
base_route: menu_ui.overview_page
|
||||||
|
weight: 100
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
menu.overview_page:
|
menu_ui.overview_page:
|
||||||
title: Menus
|
title: Menus
|
||||||
description: 'Add new menus to your site, edit existing menus, and rename and reorganize menu links.'
|
description: 'Add new menus to your site, edit existing menus, and rename and reorganize menu links.'
|
||||||
route_name: menu.overview_page
|
route_name: menu_ui.overview_page
|
||||||
parent: system.admin_structure
|
parent: system.admin_structure
|
||||||
|
|
@ -30,16 +30,16 @@ const MENU_MAX_MENU_NAME_LENGTH_UI = 27;
|
||||||
/**
|
/**
|
||||||
* Implements hook_help().
|
* Implements hook_help().
|
||||||
*/
|
*/
|
||||||
function menu_help($path, $arg) {
|
function menu_ui_help($path, $arg) {
|
||||||
switch ($path) {
|
switch ($path) {
|
||||||
case 'admin/help#menu':
|
case 'admin/help#menu_ui':
|
||||||
$output = '';
|
$output = '';
|
||||||
$output .= '<h3>' . t('About') . '</h3>';
|
$output .= '<h3>' . t('About') . '</h3>';
|
||||||
$output .= '<p>' . t('The Menu 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 module</a>.', array('!menu' => 'https://drupal.org/documentation/modules/menu/')) . '</p>';
|
$output .= '<p>' . t('The Menu 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 module</a>.', array('!menu' => 'https://drupal.org/documentation/modules/menu/')) . '</p>';
|
||||||
$output .= '<h3>' . t('Uses') . '</h3>';
|
$output .= '<h3>' . t('Uses') . '</h3>';
|
||||||
$output .= '<dl>';
|
$output .= '<dl>';
|
||||||
$output .= '<dt>' . t('Managing menus') . '</dt>';
|
$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::url('help.page', array('name' => 'block')), '!menu' => \Drupal::url('menu.overview_page'))) . '</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::url('help.page', array('name' => 'block')), '!menu' => \Drupal::url('menu_ui.overview_page'))) . '</dd>';
|
||||||
$output .= '<dt>' . t('Displaying menus') . '</dt>';
|
$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>';
|
$output .= '</dl>';
|
||||||
|
|
@ -56,7 +56,7 @@ function menu_help($path, $arg) {
|
||||||
/**
|
/**
|
||||||
* Implements hook_permission().
|
* Implements hook_permission().
|
||||||
*/
|
*/
|
||||||
function menu_permission() {
|
function menu_ui_permission() {
|
||||||
return array(
|
return array(
|
||||||
'administer menu' => array(
|
'administer menu' => array(
|
||||||
'title' => t('Administer menus and menu items'),
|
'title' => t('Administer menus and menu items'),
|
||||||
|
|
@ -67,27 +67,27 @@ function menu_permission() {
|
||||||
/**
|
/**
|
||||||
* Implements hook_entity_type_build().
|
* Implements hook_entity_type_build().
|
||||||
*/
|
*/
|
||||||
function menu_entity_type_build(array &$entity_types) {
|
function menu_ui_entity_type_build(array &$entity_types) {
|
||||||
/** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
|
/** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
|
||||||
$entity_types['menu']
|
$entity_types['menu']
|
||||||
->setFormClass('add', 'Drupal\menu\MenuFormController')
|
->setFormClass('add', 'Drupal\menu_ui\MenuFormController')
|
||||||
->setFormClass('edit', 'Drupal\menu\MenuFormController')
|
->setFormClass('edit', 'Drupal\menu_ui\MenuFormController')
|
||||||
->setFormClass('delete', 'Drupal\menu\Form\MenuDeleteForm')
|
->setFormClass('delete', 'Drupal\menu_ui\Form\MenuDeleteForm')
|
||||||
->setListBuilderClass('Drupal\menu\MenuListBuilder')
|
->setListBuilderClass('Drupal\menu_ui\MenuListBuilder')
|
||||||
->setLinkTemplate('add-form', 'menu.link_add')
|
->setLinkTemplate('add-form', 'menu_ui.link_add')
|
||||||
->setLinkTemplate('delete-form', 'menu.delete_menu')
|
->setLinkTemplate('delete-form', 'menu_ui.delete_menu')
|
||||||
->setLinkTemplate('edit-form', 'menu.menu_edit');
|
->setLinkTemplate('edit-form', 'menu_ui.menu_edit');
|
||||||
|
|
||||||
$entity_types['menu_link']
|
$entity_types['menu_link']
|
||||||
->setFormClass('delete', 'Drupal\menu\Form\MenuLinkDeleteForm')
|
->setFormClass('delete', 'Drupal\menu_ui\Form\MenuLinkDeleteForm')
|
||||||
->setFormClass('reset', 'Drupal\menu\Form\MenuLinkResetForm')
|
->setFormClass('reset', 'Drupal\menu_ui\Form\MenuLinkResetForm')
|
||||||
->setLinkTemplate('delete-form', 'menu.link_delete');
|
->setLinkTemplate('delete-form', 'menu_ui.link_delete');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements hook_entity_bundle_info().
|
* Implements hook_entity_bundle_info().
|
||||||
*/
|
*/
|
||||||
function menu_entity_bundle_info() {
|
function menu_ui_entity_bundle_info() {
|
||||||
$bundles = array();
|
$bundles = array();
|
||||||
$config_names = \Drupal::configFactory()->listAll('system.menu.');
|
$config_names = \Drupal::configFactory()->listAll('system.menu.');
|
||||||
foreach ($config_names as $config_name) {
|
foreach ($config_names as $config_name) {
|
||||||
|
|
@ -103,10 +103,10 @@ function menu_entity_bundle_info() {
|
||||||
/**
|
/**
|
||||||
* Implements hook_theme().
|
* Implements hook_theme().
|
||||||
*/
|
*/
|
||||||
function menu_theme() {
|
function menu_ui_theme() {
|
||||||
return array(
|
return array(
|
||||||
'menu_overview_form' => array(
|
'menu_overview_form' => array(
|
||||||
'file' => 'menu.admin.inc',
|
'file' => 'menu_ui.admin.inc',
|
||||||
'render element' => 'form',
|
'render element' => 'form',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
@ -120,14 +120,14 @@ function menu_theme() {
|
||||||
* @return
|
* @return
|
||||||
* Array defining the custom menu, or NULL if the menu doesn't exist.
|
* Array defining the custom menu, or NULL if the menu doesn't exist.
|
||||||
*/
|
*/
|
||||||
function menu_load($menu_name) {
|
function menu_ui_load($menu_name) {
|
||||||
return entity_load('menu', $menu_name);
|
return entity_load('menu', $menu_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements hook_menu_insert()
|
* Implements hook_menu_insert()
|
||||||
*/
|
*/
|
||||||
function menu_menu_insert(Menu $menu) {
|
function menu_ui_menu_insert(Menu $menu) {
|
||||||
menu_cache_clear_all();
|
menu_cache_clear_all();
|
||||||
// Invalidate the block cache to update menu-based derivatives.
|
// Invalidate the block cache to update menu-based derivatives.
|
||||||
if (\Drupal::moduleHandler()->moduleExists('block')) {
|
if (\Drupal::moduleHandler()->moduleExists('block')) {
|
||||||
|
|
@ -143,7 +143,7 @@ function menu_menu_insert(Menu $menu) {
|
||||||
// See menu_set_active_menu_names().
|
// See menu_set_active_menu_names().
|
||||||
$config = \Drupal::config('system.menu');
|
$config = \Drupal::config('system.menu');
|
||||||
|
|
||||||
$active_menus = $config->get('active_menus_default') ?: array_keys(menu_get_menus());
|
$active_menus = $config->get('active_menus_default') ?: array_keys(menu_ui_get_menus());
|
||||||
if (!in_array($menu->id(), $active_menus)) {
|
if (!in_array($menu->id(), $active_menus)) {
|
||||||
$active_menus[] = $menu->id();
|
$active_menus[] = $menu->id();
|
||||||
$config
|
$config
|
||||||
|
|
@ -155,7 +155,7 @@ function menu_menu_insert(Menu $menu) {
|
||||||
/**
|
/**
|
||||||
* Implements hook_menu_update().
|
* Implements hook_menu_update().
|
||||||
*/
|
*/
|
||||||
function menu_menu_update(Menu $menu) {
|
function menu_ui_menu_update(Menu $menu) {
|
||||||
menu_cache_clear_all();
|
menu_cache_clear_all();
|
||||||
// Invalidate the block cache to update menu-based derivatives.
|
// Invalidate the block cache to update menu-based derivatives.
|
||||||
if (\Drupal::moduleHandler()->moduleExists('block')) {
|
if (\Drupal::moduleHandler()->moduleExists('block')) {
|
||||||
|
|
@ -166,13 +166,13 @@ function menu_menu_update(Menu $menu) {
|
||||||
/**
|
/**
|
||||||
* Implements hook_menu_predelete().
|
* Implements hook_menu_predelete().
|
||||||
*/
|
*/
|
||||||
function menu_menu_predelete(Menu $menu) {
|
function menu_ui_menu_predelete(Menu $menu) {
|
||||||
// Delete all links from the menu.
|
// Delete all links from the menu.
|
||||||
menu_delete_links($menu->id());
|
menu_delete_links($menu->id());
|
||||||
|
|
||||||
// Remove menu from active menus variable.
|
// Remove menu from active menus variable.
|
||||||
$config = \Drupal::config('system.menu');
|
$config = \Drupal::config('system.menu');
|
||||||
$active_menus = $config->get('active_menus_default') ?: array_keys(menu_get_menus());
|
$active_menus = $config->get('active_menus_default') ?: array_keys(menu_ui_get_menus());
|
||||||
if (in_array($menu->id(), $active_menus)) {
|
if (in_array($menu->id(), $active_menus)) {
|
||||||
$active_menus = array_diff($active_menus, array($menu->id()));
|
$active_menus = array_diff($active_menus, array($menu->id()));
|
||||||
// Prevent the gap left by the removed menu from causing array indices to
|
// Prevent the gap left by the removed menu from causing array indices to
|
||||||
|
|
@ -187,7 +187,7 @@ function menu_menu_predelete(Menu $menu) {
|
||||||
/**
|
/**
|
||||||
* Implements hook_menu_delete().
|
* Implements hook_menu_delete().
|
||||||
*/
|
*/
|
||||||
function menu_menu_delete(Menu $menu) {
|
function menu_ui_menu_delete(Menu $menu) {
|
||||||
menu_cache_clear_all();
|
menu_cache_clear_all();
|
||||||
|
|
||||||
// Invalidate the block cache to update menu-based derivatives.
|
// Invalidate the block cache to update menu-based derivatives.
|
||||||
|
|
@ -201,7 +201,7 @@ function menu_menu_delete(Menu $menu) {
|
||||||
* menu link.
|
* menu link.
|
||||||
*
|
*
|
||||||
* @param array $menus
|
* @param array $menus
|
||||||
* An array of menu names and titles, such as from menu_get_menus().
|
* An array of menu names and titles, such as from menu_ui_get_menus().
|
||||||
* @param \Drupal\menu_link\Entity\MenuLink $menu_link
|
* @param \Drupal\menu_link\Entity\MenuLink $menu_link
|
||||||
* The menu link for which to generate a list of parents.
|
* The menu link for which to generate a list of parents.
|
||||||
* If $menu_link->id() == 0 then the complete tree is returned.
|
* If $menu_link->id() == 0 then the complete tree is returned.
|
||||||
|
|
@ -216,12 +216,12 @@ function menu_menu_delete(Menu $menu) {
|
||||||
* @todo This has to be turned into a #process form element callback. The
|
* @todo This has to be turned into a #process form element callback. The
|
||||||
* 'override_parent_selector' variable is entirely superfluous.
|
* 'override_parent_selector' variable is entirely superfluous.
|
||||||
*/
|
*/
|
||||||
function menu_parent_options(array $menus, MenuLink $menu_link = NULL, $type = NULL) {
|
function menu_ui_parent_options(array $menus, MenuLink $menu_link = NULL, $type = NULL) {
|
||||||
// The menu_links table can be practically any size and we need a way to
|
// The menu_links table can be practically any size and we need a way to
|
||||||
// allow contrib modules to provide more scalable pattern choosers.
|
// allow contrib modules to provide more scalable pattern choosers.
|
||||||
// hook_form_alter is too late in itself because all the possible parents are
|
// hook_form_alter is too late in itself because all the possible parents are
|
||||||
// retrieved here, unless override_parent_selector is set to TRUE.
|
// retrieved here, unless override_parent_selector is set to TRUE.
|
||||||
if (\Drupal::config('menu.settings')->get('override_parent_selector')) {
|
if (\Drupal::config('menu_ui.settings')->get('override_parent_selector')) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -242,19 +242,19 @@ function menu_parent_options(array $menus, MenuLink $menu_link = NULL, $type = N
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _menu_get_options($menus, $available_menus, $menu_link);
|
return _menu_ui_get_options($menus, $available_menus, $menu_link);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to get the items of the given menu.
|
* Helper function to get the items of the given menu.
|
||||||
*/
|
*/
|
||||||
function _menu_get_options($menus, $available_menus, $item) {
|
function _menu_ui_get_options($menus, $available_menus, $item) {
|
||||||
// If the item has children, there is an added limit to the depth of valid parents.
|
// If the item has children, there is an added limit to the depth of valid parents.
|
||||||
if (isset($item['parent_depth_limit'])) {
|
if (isset($item['parent_depth_limit'])) {
|
||||||
$limit = $item['parent_depth_limit'];
|
$limit = $item['parent_depth_limit'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$limit = _menu_parent_depth_limit($item);
|
$limit = _menu_ui_parent_depth_limit($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var \Drupal\menu_link\MenuTreeInterface $menu_tree */
|
/** @var \Drupal\menu_link\MenuTreeInterface $menu_tree */
|
||||||
|
|
@ -265,16 +265,16 @@ function _menu_get_options($menus, $available_menus, $item) {
|
||||||
if (isset($available_menus[$menu_name])) {
|
if (isset($available_menus[$menu_name])) {
|
||||||
$tree = $menu_tree->buildAllData($menu_name, NULL);
|
$tree = $menu_tree->buildAllData($menu_name, NULL);
|
||||||
$options[$menu_name . ':0'] = '<' . $title . '>';
|
$options[$menu_name . ':0'] = '<' . $title . '>';
|
||||||
_menu_parents_recurse($tree, $menu_name, '--', $options, $item['mlid'], $limit);
|
_menu_ui_parents_recurse($tree, $menu_name, '--', $options, $item['mlid'], $limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursive helper function for menu_parent_options().
|
* Recursive helper function for menu_ui_parent_options().
|
||||||
*/
|
*/
|
||||||
function _menu_parents_recurse($tree, $menu_name, $indent, &$options, $exclude, $depth_limit) {
|
function _menu_ui_parents_recurse($tree, $menu_name, $indent, &$options, $exclude, $depth_limit) {
|
||||||
foreach ($tree as $data) {
|
foreach ($tree as $data) {
|
||||||
if ($data['link']['depth'] > $depth_limit) {
|
if ($data['link']['depth'] > $depth_limit) {
|
||||||
// Don't iterate through any links on this level.
|
// Don't iterate through any links on this level.
|
||||||
|
|
@ -287,7 +287,7 @@ function _menu_parents_recurse($tree, $menu_name, $indent, &$options, $exclude,
|
||||||
}
|
}
|
||||||
$options[$menu_name . ':' . $data['link']['mlid']] = $title;
|
$options[$menu_name . ':' . $data['link']['mlid']] = $title;
|
||||||
if ($data['below']) {
|
if ($data['below']) {
|
||||||
_menu_parents_recurse($data['below'], $menu_name, $indent . '--', $options, $exclude, $depth_limit);
|
_menu_ui_parents_recurse($data['below'], $menu_name, $indent . '--', $options, $exclude, $depth_limit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -296,7 +296,7 @@ function _menu_parents_recurse($tree, $menu_name, $indent, &$options, $exclude,
|
||||||
/**
|
/**
|
||||||
* Implements hook_block_view_BASE_BLOCK_ID_alter() for 'system_menu_block'.
|
* Implements hook_block_view_BASE_BLOCK_ID_alter() for 'system_menu_block'.
|
||||||
*/
|
*/
|
||||||
function menu_block_view_system_menu_block_alter(array &$build, BlockPluginInterface $block) {
|
function menu_ui_block_view_system_menu_block_alter(array &$build, BlockPluginInterface $block) {
|
||||||
// Add contextual links for system menu blocks.
|
// Add contextual links for system menu blocks.
|
||||||
$menus = menu_list_system_menus();
|
$menus = menu_list_system_menus();
|
||||||
$menu_name = $block->getDerivativeId();
|
$menu_name = $block->getDerivativeId();
|
||||||
|
|
@ -312,21 +312,21 @@ function menu_block_view_system_menu_block_alter(array &$build, BlockPluginInter
|
||||||
/**
|
/**
|
||||||
* Implements hook_node_insert().
|
* Implements hook_node_insert().
|
||||||
*/
|
*/
|
||||||
function menu_node_insert(EntityInterface $node) {
|
function menu_ui_node_insert(EntityInterface $node) {
|
||||||
menu_node_save($node);
|
menu_ui_node_save($node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements hook_node_update().
|
* Implements hook_node_update().
|
||||||
*/
|
*/
|
||||||
function menu_node_update(EntityInterface $node) {
|
function menu_ui_node_update(EntityInterface $node) {
|
||||||
menu_node_save($node);
|
menu_ui_node_save($node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements hook_node_type_insert().
|
* Implements hook_node_type_insert().
|
||||||
*/
|
*/
|
||||||
function menu_node_type_insert(NodeTypeInterface $type) {
|
function menu_ui_node_type_insert(NodeTypeInterface $type) {
|
||||||
if ($type->isSyncing()) {
|
if ($type->isSyncing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -339,7 +339,7 @@ function menu_node_type_insert(NodeTypeInterface $type) {
|
||||||
/**
|
/**
|
||||||
* Implements hook_node_type_delete().
|
* Implements hook_node_type_delete().
|
||||||
*/
|
*/
|
||||||
function menu_node_type_delete(NodeTypeInterface $type) {
|
function menu_ui_node_type_delete(NodeTypeInterface $type) {
|
||||||
if ($type->isSyncing()) {
|
if ($type->isSyncing()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -349,7 +349,7 @@ function menu_node_type_delete(NodeTypeInterface $type) {
|
||||||
/**
|
/**
|
||||||
* Helper for hook_node_insert() and hook_node_update().
|
* Helper for hook_node_insert() and hook_node_update().
|
||||||
*/
|
*/
|
||||||
function menu_node_save(EntityInterface $node) {
|
function menu_ui_node_save(EntityInterface $node) {
|
||||||
if (isset($node->menu)) {
|
if (isset($node->menu)) {
|
||||||
$link = &$node->menu;
|
$link = &$node->menu;
|
||||||
if (empty($link['enabled'])) {
|
if (empty($link['enabled'])) {
|
||||||
|
|
@ -378,7 +378,7 @@ function menu_node_save(EntityInterface $node) {
|
||||||
/**
|
/**
|
||||||
* Implements hook_node_predelete().
|
* Implements hook_node_predelete().
|
||||||
*/
|
*/
|
||||||
function menu_node_predelete(EntityInterface $node) {
|
function menu_ui_node_predelete(EntityInterface $node) {
|
||||||
// Delete all menu module links that point to this node.
|
// Delete all menu module links that point to this node.
|
||||||
$query = \Drupal::entityQuery('menu_link')
|
$query = \Drupal::entityQuery('menu_link')
|
||||||
->condition('link_path', 'node/' . $node->id())
|
->condition('link_path', 'node/' . $node->id())
|
||||||
|
|
@ -393,7 +393,7 @@ function menu_node_predelete(EntityInterface $node) {
|
||||||
/**
|
/**
|
||||||
* Implements hook_node_prepare_form().
|
* Implements hook_node_prepare_form().
|
||||||
*/
|
*/
|
||||||
function menu_node_prepare_form(NodeInterface $node, $operation, array &$form_state) {
|
function menu_ui_node_prepare_form(NodeInterface $node, $operation, array &$form_state) {
|
||||||
if (empty($node->menu)) {
|
if (empty($node->menu)) {
|
||||||
// Prepare the node for the edit form so that $node->menu always exists.
|
// Prepare the node for the edit form so that $node->menu always exists.
|
||||||
$node_type_config = \Drupal::config('menu.entity.node.' . $node->getType());
|
$node_type_config = \Drupal::config('menu.entity.node.' . $node->getType());
|
||||||
|
|
@ -407,7 +407,7 @@ function menu_node_prepare_form(NodeInterface $node, $operation, array &$form_st
|
||||||
$query = \Drupal::entityQuery('menu_link')
|
$query = \Drupal::entityQuery('menu_link')
|
||||||
->condition('link_path', 'node/' . $node->id())
|
->condition('link_path', 'node/' . $node->id())
|
||||||
->condition('menu_name', $menu_name)
|
->condition('menu_name', $menu_name)
|
||||||
->condition('module', 'menu')
|
->condition('module', 'menu_ui')
|
||||||
->sort('mlid', 'ASC')
|
->sort('mlid', 'ASC')
|
||||||
->range(0, 1);
|
->range(0, 1);
|
||||||
$result = $query->execute();
|
$result = $query->execute();
|
||||||
|
|
@ -419,7 +419,7 @@ function menu_node_prepare_form(NodeInterface $node, $operation, array &$form_st
|
||||||
$query = \Drupal::entityQuery('menu_link')
|
$query = \Drupal::entityQuery('menu_link')
|
||||||
->condition('link_path', 'node/' . $node->id())
|
->condition('link_path', 'node/' . $node->id())
|
||||||
->condition('menu_name', array_values($type_menus), 'IN')
|
->condition('menu_name', array_values($type_menus), 'IN')
|
||||||
->condition('module', 'menu')
|
->condition('module', 'menu_ui')
|
||||||
->sort('mlid', 'ASC')
|
->sort('mlid', 'ASC')
|
||||||
->range(0, 1);
|
->range(0, 1);
|
||||||
$result = $query->execute();
|
$result = $query->execute();
|
||||||
|
|
@ -443,14 +443,14 @@ function menu_node_prepare_form(NodeInterface $node, $operation, array &$form_st
|
||||||
}
|
}
|
||||||
// Find the depth limit for the parent select.
|
// Find the depth limit for the parent select.
|
||||||
if (!isset($node->menu['parent_depth_limit'])) {
|
if (!isset($node->menu['parent_depth_limit'])) {
|
||||||
$node->menu['parent_depth_limit'] = _menu_parent_depth_limit($node->menu);
|
$node->menu['parent_depth_limit'] = _menu_ui_parent_depth_limit($node->menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the depth limit for items in the parent select.
|
* Find the depth limit for items in the parent select.
|
||||||
*/
|
*/
|
||||||
function _menu_parent_depth_limit($item) {
|
function _menu_ui_parent_depth_limit($item) {
|
||||||
return MENU_MAX_DEPTH - 1 - (($item['mlid'] && $item['has_children']) ? entity_get_controller('menu_link')->findChildrenRelativeDepth($item) : 0);
|
return MENU_MAX_DEPTH - 1 - (($item['mlid'] && $item['has_children']) ? entity_get_controller('menu_link')->findChildrenRelativeDepth($item) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -459,15 +459,15 @@ function _menu_parent_depth_limit($item) {
|
||||||
*
|
*
|
||||||
* Adds menu item fields to the node form.
|
* Adds menu item fields to the node form.
|
||||||
*
|
*
|
||||||
* @see menu_node_submit()
|
* @see menu_ui_node_submit()
|
||||||
*/
|
*/
|
||||||
function menu_form_node_form_alter(&$form, $form_state) {
|
function menu_ui_form_node_form_alter(&$form, $form_state) {
|
||||||
// Generate a list of possible parents (not including this link or descendants).
|
// Generate a list of possible parents (not including this link or descendants).
|
||||||
// @todo This must be handled in a #process handler.
|
// @todo This must be handled in a #process handler.
|
||||||
$node = $form_state['controller']->getEntity();
|
$node = $form_state['controller']->getEntity();
|
||||||
$link = $node->menu;
|
$link = $node->menu;
|
||||||
$type = $node->getType();
|
$type = $node->getType();
|
||||||
$options = menu_parent_options(menu_get_menus(), $link, $type);
|
$options = menu_ui_parent_options(menu_ui_get_menus(), $link, $type);
|
||||||
// If no possible parent menu items were found, there is nothing to display.
|
// If no possible parent menu items were found, there is nothing to display.
|
||||||
if (empty($options)) {
|
if (empty($options)) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -560,9 +560,9 @@ function menu_form_node_form_alter(&$form, $form_state) {
|
||||||
/**
|
/**
|
||||||
* Implements hook_node_submit().
|
* Implements hook_node_submit().
|
||||||
*
|
*
|
||||||
* @see menu_form_node_form_alter()
|
* @see menu_ui_form_node_form_alter()
|
||||||
*/
|
*/
|
||||||
function menu_node_submit(EntityInterface $node, $form, $form_state) {
|
function menu_ui_node_submit(EntityInterface $node, $form, $form_state) {
|
||||||
if (!empty($form_state['values']['menu'])) {
|
if (!empty($form_state['values']['menu'])) {
|
||||||
$node->menu = entity_create('menu_link', $form_state['values']['menu']);
|
$node->menu = entity_create('menu_link', $form_state['values']['menu']);
|
||||||
// Decompose the selected menu parent option into 'menu_name' and 'plid', if
|
// Decompose the selected menu parent option into 'menu_name' and 'plid', if
|
||||||
|
|
@ -579,10 +579,10 @@ function menu_node_submit(EntityInterface $node, $form, $form_state) {
|
||||||
* Adds menu options to the node type form.
|
* Adds menu options to the node type form.
|
||||||
*
|
*
|
||||||
* @see NodeTypeFormController::form().
|
* @see NodeTypeFormController::form().
|
||||||
* @see menu_form_node_type_form_submit().
|
* @see menu_ui_form_node_type_form_submit().
|
||||||
*/
|
*/
|
||||||
function menu_form_node_type_form_alter(&$form, $form_state) {
|
function menu_ui_form_node_type_form_alter(&$form, $form_state) {
|
||||||
$menu_options = menu_get_menus();
|
$menu_options = menu_ui_get_menus();
|
||||||
$type = $form_state['controller']->getEntity();
|
$type = $form_state['controller']->getEntity();
|
||||||
if ($type->id()) {
|
if ($type->id()) {
|
||||||
$config_values = \Drupal::config('menu.entity.node.' . $type->id())->get();
|
$config_values = \Drupal::config('menu.entity.node.' . $type->id())->get();
|
||||||
|
|
@ -611,9 +611,9 @@ function menu_form_node_type_form_alter(&$form, $form_state) {
|
||||||
// To avoid an 'illegal option' error after saving the form we have to load
|
// To avoid an 'illegal option' error after saving the form we have to load
|
||||||
// all available menu items.
|
// all available menu items.
|
||||||
// Otherwise it is not possible to dynamically add options to the list.
|
// Otherwise it is not possible to dynamically add options to the list.
|
||||||
// @todo Convert menu_parent_options() into a #process callback.
|
// @todo Convert menu_ui_parent_options() into a #process callback.
|
||||||
$menu_link = entity_create('menu_link', array('mlid' => 0));
|
$menu_link = entity_create('menu_link', array('mlid' => 0));
|
||||||
$options = menu_parent_options(menu_get_menus(), $menu_link);
|
$options = menu_ui_parent_options(menu_ui_get_menus(), $menu_link);
|
||||||
$form['menu']['menu_parent'] = array(
|
$form['menu']['menu_parent'] = array(
|
||||||
'#type' => 'select',
|
'#type' => 'select',
|
||||||
'#title' => t('Default parent item'),
|
'#title' => t('Default parent item'),
|
||||||
|
|
@ -623,15 +623,15 @@ function menu_form_node_type_form_alter(&$form, $form_state) {
|
||||||
'#attributes' => array('class' => array('menu-title-select')),
|
'#attributes' => array('class' => array('menu-title-select')),
|
||||||
);
|
);
|
||||||
|
|
||||||
$form['actions']['submit']['#submit'][] = 'menu_form_node_type_form_submit';
|
$form['actions']['submit']['#submit'][] = 'menu_ui_form_node_type_form_submit';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit handler for forms with menu options.
|
* Submit handler for forms with menu options.
|
||||||
*
|
*
|
||||||
* @see menu_form_node_type_form_alter().
|
* @see menu_ui_form_node_type_form_alter().
|
||||||
*/
|
*/
|
||||||
function menu_form_node_type_form_submit(&$form, $form_state) {
|
function menu_ui_form_node_type_form_submit(&$form, $form_state) {
|
||||||
$type = $form_state['controller']->getEntity();
|
$type = $form_state['controller']->getEntity();
|
||||||
\Drupal::config('menu.entity.node.' . $type->id())
|
\Drupal::config('menu.entity.node.' . $type->id())
|
||||||
->set('available_menus', array_values(array_filter($form_state['values']['menu_options'])))
|
->set('available_menus', array_values(array_filter($form_state['values']['menu_options'])))
|
||||||
|
|
@ -649,7 +649,7 @@ function menu_form_node_type_form_submit(&$form, $form_state) {
|
||||||
* An array with the machine-readable names as the keys, and human-readable
|
* An array with the machine-readable names as the keys, and human-readable
|
||||||
* titles as the values.
|
* titles as the values.
|
||||||
*/
|
*/
|
||||||
function menu_get_menus($all = TRUE) {
|
function menu_ui_get_menus($all = TRUE) {
|
||||||
if ($custom_menus = entity_load_multiple('menu')) {
|
if ($custom_menus = entity_load_multiple('menu')) {
|
||||||
if (!$all) {
|
if (!$all) {
|
||||||
$custom_menus = array_diff_key($custom_menus, menu_list_system_menus());
|
$custom_menus = array_diff_key($custom_menus, menu_list_system_menus());
|
||||||
|
|
@ -665,8 +665,8 @@ function menu_get_menus($all = TRUE) {
|
||||||
/**
|
/**
|
||||||
* Implements hook_preprocess_HOOK() for block templates.
|
* Implements hook_preprocess_HOOK() for block templates.
|
||||||
*/
|
*/
|
||||||
function menu_preprocess_block(&$variables) {
|
function menu_ui_preprocess_block(&$variables) {
|
||||||
if ($variables['configuration']['provider'] == 'menu') {
|
if ($variables['configuration']['provider'] == 'menu_ui') {
|
||||||
$variables['attributes']['role'] = 'navigation';
|
$variables['attributes']['role'] = 'navigation';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
menu.settings:
|
menu_ui.settings:
|
||||||
path: '/admin/structure/menu/settings'
|
path: '/admin/structure/menu/settings'
|
||||||
defaults:
|
defaults:
|
||||||
_form: 'Drupal\menu\MenuSettingsForm'
|
_form: 'Drupal\menu_ui\MenuSettingsForm'
|
||||||
_title: 'Menus'
|
_title: 'Menus'
|
||||||
requirements:
|
requirements:
|
||||||
_permission: 'administer menu'
|
_permission: 'administer menu'
|
||||||
|
|
||||||
menu.overview_page:
|
menu_ui.overview_page:
|
||||||
path: '/admin/structure/menu'
|
path: '/admin/structure/menu'
|
||||||
defaults:
|
defaults:
|
||||||
_entity_list: 'menu'
|
_entity_list: 'menu'
|
||||||
|
|
@ -14,22 +14,22 @@ menu.overview_page:
|
||||||
requirements:
|
requirements:
|
||||||
_permission: 'administer menu'
|
_permission: 'administer menu'
|
||||||
|
|
||||||
menu.parent_options_js:
|
menu_ui.parent_options_js:
|
||||||
path: '/admin/structure/menu/parents'
|
path: '/admin/structure/menu/parents'
|
||||||
defaults:
|
defaults:
|
||||||
_controller: '\Drupal\menu\Controller\MenuController::getParentOptions'
|
_controller: '\Drupal\menu_ui\Controller\MenuController::getParentOptions'
|
||||||
requirements:
|
requirements:
|
||||||
_permission: 'administer menu'
|
_permission: 'administer menu'
|
||||||
|
|
||||||
menu.link_add:
|
menu_ui.link_add:
|
||||||
path: '/admin/structure/menu/manage/{menu}/add'
|
path: '/admin/structure/menu/manage/{menu}/add'
|
||||||
defaults:
|
defaults:
|
||||||
_content: '\Drupal\menu\Controller\MenuController::addLink'
|
_content: '\Drupal\menu_ui\Controller\MenuController::addLink'
|
||||||
_title: 'Add menu link'
|
_title: 'Add menu link'
|
||||||
requirements:
|
requirements:
|
||||||
_entity_create_access: 'menu_link'
|
_entity_create_access: 'menu_link'
|
||||||
|
|
||||||
menu.link_edit:
|
menu_ui.link_edit:
|
||||||
path: '/admin/structure/menu/item/{menu_link}/edit'
|
path: '/admin/structure/menu/item/{menu_link}/edit'
|
||||||
defaults:
|
defaults:
|
||||||
_entity_form: 'menu_link'
|
_entity_form: 'menu_link'
|
||||||
|
|
@ -37,7 +37,7 @@ menu.link_edit:
|
||||||
requirements:
|
requirements:
|
||||||
_entity_access: 'menu_link.update'
|
_entity_access: 'menu_link.update'
|
||||||
|
|
||||||
menu.link_reset:
|
menu_ui.link_reset:
|
||||||
path: '/admin/structure/menu/item/{menu_link}/reset'
|
path: '/admin/structure/menu/item/{menu_link}/reset'
|
||||||
defaults:
|
defaults:
|
||||||
_entity_form: 'menu_link.reset'
|
_entity_form: 'menu_link.reset'
|
||||||
|
|
@ -45,7 +45,7 @@ menu.link_reset:
|
||||||
requirements:
|
requirements:
|
||||||
_entity_access: 'menu_link.reset'
|
_entity_access: 'menu_link.reset'
|
||||||
|
|
||||||
menu.link_delete:
|
menu_ui.link_delete:
|
||||||
path: '/admin/structure/menu/item/{menu_link}/delete'
|
path: '/admin/structure/menu/item/{menu_link}/delete'
|
||||||
defaults:
|
defaults:
|
||||||
_entity_form: 'menu_link.delete'
|
_entity_form: 'menu_link.delete'
|
||||||
|
|
@ -53,7 +53,7 @@ menu.link_delete:
|
||||||
requirements:
|
requirements:
|
||||||
_entity_access: 'menu_link.delete'
|
_entity_access: 'menu_link.delete'
|
||||||
|
|
||||||
menu.menu_add:
|
menu_ui.menu_add:
|
||||||
path: '/admin/structure/menu/add'
|
path: '/admin/structure/menu/add'
|
||||||
defaults:
|
defaults:
|
||||||
_entity_form: 'menu.add'
|
_entity_form: 'menu.add'
|
||||||
|
|
@ -61,15 +61,15 @@ menu.menu_add:
|
||||||
requirements:
|
requirements:
|
||||||
_entity_create_access: 'menu'
|
_entity_create_access: 'menu'
|
||||||
|
|
||||||
menu.menu_edit:
|
menu_ui.menu_edit:
|
||||||
path: '/admin/structure/menu/manage/{menu}'
|
path: '/admin/structure/menu/manage/{menu}'
|
||||||
defaults:
|
defaults:
|
||||||
_entity_form: 'menu.edit'
|
_entity_form: 'menu.edit'
|
||||||
_title_callback: '\Drupal\menu\Controller\MenuController::menuTitle'
|
_title_callback: '\Drupal\menu_ui\Controller\MenuController::menuTitle'
|
||||||
requirements:
|
requirements:
|
||||||
_entity_access: 'menu.update'
|
_entity_access: 'menu.update'
|
||||||
|
|
||||||
menu.delete_menu:
|
menu_ui.delete_menu:
|
||||||
path: '/admin/structure/menu/manage/{menu}/delete'
|
path: '/admin/structure/menu/manage/{menu}/delete'
|
||||||
defaults:
|
defaults:
|
||||||
_entity_form: 'menu.delete'
|
_entity_form: 'menu.delete'
|
||||||
|
|
@ -11,4 +11,4 @@ process:
|
||||||
override_parent_selector: menu_override_parent_selector
|
override_parent_selector: menu_override_parent_selector
|
||||||
destination:
|
destination:
|
||||||
plugin: config
|
plugin: config
|
||||||
config_name: menu.settings
|
config_name: menu_ui.settings
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
namespace Drupal\migrate_drupal\Tests\Dump;
|
namespace Drupal\migrate_drupal\Tests\Dump;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database dump for testing menu.settings.yml migration.
|
* Database dump for testing menu_ui.settings.yml migration.
|
||||||
*/
|
*/
|
||||||
class Drupal6MenuSettings extends Drupal6DumpBase {
|
class Drupal6MenuSettings extends Drupal6DumpBase {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,15 @@ class MigrateMenuConfigsTest extends MigrateDrupalTestBase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $modules = array('menu');
|
public static $modules = array('menu_ui');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public static function getInfo() {
|
public static function getInfo() {
|
||||||
return array(
|
return array(
|
||||||
'name' => 'Migrate variables to menu.settings.yml',
|
'name' => 'Migrate variables to menu_ui.settings.yml',
|
||||||
'description' => 'Upgrade variables to menu.settings.yml',
|
'description' => 'Upgrade variables to menu_ui.settings.yml',
|
||||||
'group' => 'Migrate Drupal',
|
'group' => 'Migrate Drupal',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -51,7 +51,7 @@ class MigrateMenuConfigsTest extends MigrateDrupalTestBase {
|
||||||
* Tests migration of variables for the menu module.
|
* Tests migration of variables for the menu module.
|
||||||
*/
|
*/
|
||||||
public function testMenuSettings() {
|
public function testMenuSettings() {
|
||||||
$config = \Drupal::config('menu.settings');
|
$config = \Drupal::config('menu_ui.settings');
|
||||||
$this->assertIdentical($config->get('main_links'), 'primary-links');
|
$this->assertIdentical($config->get('main_links'), 'primary-links');
|
||||||
$this->assertIdentical($config->get('secondary_links'), 'secondary-links');
|
$this->assertIdentical($config->get('secondary_links'), 'secondary-links');
|
||||||
$this->assertIdentical($config->get('override_parent_selector'), FALSE);
|
$this->assertIdentical($config->get('override_parent_selector'), FALSE);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use Drupal\Core\Cache\Cache;
|
||||||
*
|
*
|
||||||
* @see \Drupal\system\Tests\Bootstrap\PageCacheTest
|
* @see \Drupal\system\Tests\Bootstrap\PageCacheTest
|
||||||
* @see \Drupal\node\Tests\NodePageCacheTest
|
* @see \Drupal\node\Tests\NodePageCacheTest
|
||||||
* @see \Drupal\menu\Tests\MenuTest::testMenuBlockPageCacheTags()
|
* @see \Drupal\menu_ui\Tests\MenuTest::testMenuBlockPageCacheTags()
|
||||||
*/
|
*/
|
||||||
class PageCacheTagsIntegrationTest extends WebTestBase {
|
class PageCacheTagsIntegrationTest extends WebTestBase {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,4 @@ core: 8.x
|
||||||
hidden: true
|
hidden: true
|
||||||
dependencies:
|
dependencies:
|
||||||
- test_page_test
|
- test_page_test
|
||||||
- menu
|
- menu_ui
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class ToolbarAdminMenuTest extends WebTestBase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $modules = array('node', 'block', 'menu', 'user', 'taxonomy', 'toolbar', 'language', 'test_page_test', 'locale');
|
public static $modules = array('node', 'block', 'menu_ui', 'user', 'taxonomy', 'toolbar', 'language', 'test_page_test', 'locale');
|
||||||
|
|
||||||
public static function getInfo() {
|
public static function getInfo() {
|
||||||
return array(
|
return array(
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class UserAccountLinksTests extends WebTestBase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public static $modules = array('menu', 'block', 'test_page_test');
|
public static $modules = array('menu_ui', 'block', 'test_page_test');
|
||||||
|
|
||||||
public static function getInfo() {
|
public static function getInfo() {
|
||||||
return array(
|
return array(
|
||||||
|
|
|
||||||
|
|
@ -217,11 +217,11 @@ class Page extends PathPluginBase {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Only display the menu selector if menu module is enabled.
|
// Only display the menu selector if menu module is enabled.
|
||||||
if (\Drupal::moduleHandler()->moduleExists('menu')) {
|
if (\Drupal::moduleHandler()->moduleExists('menu_ui')) {
|
||||||
$form['menu']['name'] = array(
|
$form['menu']['name'] = array(
|
||||||
'#title' => t('Menu'),
|
'#title' => t('Menu'),
|
||||||
'#type' => 'select',
|
'#type' => 'select',
|
||||||
'#options' => menu_get_menus(),
|
'#options' => menu_ui_get_menus(),
|
||||||
'#default_value' => $menu['name'],
|
'#default_value' => $menu['name'],
|
||||||
'#states' => array(
|
'#states' => array(
|
||||||
'visible' => array(
|
'visible' => array(
|
||||||
|
|
@ -334,11 +334,11 @@ class Page extends PathPluginBase {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
// Only display the menu selector if menu module is enabled.
|
// Only display the menu selector if menu module is enabled.
|
||||||
if (\Drupal::moduleHandler()->moduleExists('menu')) {
|
if (\Drupal::moduleHandler()->moduleExists('menu_ui')) {
|
||||||
$form['tab_options']['name'] = array(
|
$form['tab_options']['name'] = array(
|
||||||
'#title' => t('Menu'),
|
'#title' => t('Menu'),
|
||||||
'#type' => 'select',
|
'#type' => 'select',
|
||||||
'#options' => menu_get_menus(),
|
'#options' => menu_ui_get_menus(),
|
||||||
'#default_value' => $tab_options['name'],
|
'#default_value' => $tab_options['name'],
|
||||||
'#description' => t('Insert item into an available menu.'),
|
'#description' => t('Insert item into an available menu.'),
|
||||||
'#states' => array(
|
'#states' => array(
|
||||||
|
|
|
||||||
|
|
@ -292,8 +292,8 @@ abstract class WizardPluginBase extends PluginBase implements WizardInterface {
|
||||||
'#prefix' => '<div id="edit-page-link-properties-wrapper">',
|
'#prefix' => '<div id="edit-page-link-properties-wrapper">',
|
||||||
'#suffix' => '</div>',
|
'#suffix' => '</div>',
|
||||||
);
|
);
|
||||||
if (\Drupal::moduleHandler()->moduleExists('menu')) {
|
if (\Drupal::moduleHandler()->moduleExists('menu_ui')) {
|
||||||
$menu_options = menu_get_menus();
|
$menu_options = menu_ui_get_menus();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// These are not yet translated.
|
// These are not yet translated.
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class DisplayPath extends UITestBase {
|
||||||
* Tests the menu and tab option form.
|
* Tests the menu and tab option form.
|
||||||
*/
|
*/
|
||||||
public function testMenuOptions() {
|
public function testMenuOptions() {
|
||||||
$this->container->get('module_handler')->install(array('menu'));
|
$this->container->get('module_handler')->install(array('menu_ui'));
|
||||||
$this->drupalGet('admin/structure/views/view/test_view');
|
$this->drupalGet('admin/structure/views/view/test_view');
|
||||||
|
|
||||||
// Add a new page display.
|
// Add a new page display.
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ dependencies:
|
||||||
- entity_reference
|
- entity_reference
|
||||||
- help
|
- help
|
||||||
- image
|
- image
|
||||||
- menu
|
- menu_ui
|
||||||
- options
|
- options
|
||||||
- path
|
- path
|
||||||
- taxonomy
|
- taxonomy
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue