forked from webflo/drupal-menu_link_weight_extended
-
Notifications
You must be signed in to change notification settings - Fork 0
/
menu_link_weight_extended.module
34 lines (30 loc) · 1.25 KB
/
menu_link_weight_extended.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* @file
* Contains menu_link_weight_extended.module..
*/
use Drupal\Component\Utility\Html;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\menu_link_content\Form\MenuLinkContentForm;
use Drupal\system\Entity\Menu;
/**
* Implements hook_entity_type_build()
*
* Add the menu_link_weight_extended form controllers to the entity type config object.
*/
function menu_link_weight_extended_entity_type_build(array &$entity_types) {
/** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
$entity_types['menu']->setFormClass('edit_menu_link_weight_extended', 'Drupal\menu_link_weight_extended\MenuFormLinkController');
$entity_types['menu']->setFormClass('edit_menu_link_weight_extended_slice', 'Drupal\menu_link_weight_extended\MenuSliceFormController');
}
/**
* Implements hook_menu_local_actions_alter().
*/
function menu_link_weight_extended_menu_local_actions_alter(&$local_actions) {
if (isset($local_actions['entity.menu.add_link_form'])) {
// Add local actions to routes provided by this module.
$local_actions['entity.menu.add_link_form']['appears_on'][] = 'menu_link_weight_extended.menu';
$local_actions['entity.menu.add_link_form']['appears_on'][] = 'menu_link_weight_extended.menu_link';
}
}