forked from ueberbit/bigmenu
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbigmenu.module
62 lines (58 loc) · 2.04 KB
/
bigmenu.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* @file alternative to core menu management
*
* Needed when menus get to big to load on one page.
*
* CONFLICTS WITH tiny_menu. Appropriately enough.
*
* Some of the code here - especially the form cache rebuild trigger in
* bigmenu_slice_form_js() and the parameters sent on the AJAX URL string feel
* quite ungainly.
* However the main target - to be able to layer on this flexibility without
* modifying core - made a few work-arounds neccessary.
*
* I did NOT use full Drupal core AHAH routines, as they seemed to rely on the
* entire form being submitted and rebuilt in the background each page load.
*
* As the focus of this module is on *scaling* - I couldn't add that overhead,
* so the subforms are generated independently, not as part of the main overview
* form. This is why the bigmenu_slice_form_js() cheats form_cache a little bit.
*
* @author Dan (dman) Morrison [email protected]
* @version 2011
*/
/**
* Implements hook_entity_type_build()
*
* Add the bigmenu form controllers to the entity type config object.
*/
function bigmenu_entity_type_build(array &$entity_types) {
/** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
$entity_types['menu']->setFormClass('edit_bigmenu', 'Drupal\bigmenu\MenuFormLinkController');
$entity_types['menu']->setFormClass('edit_bigmenu_slice', 'Drupal\bigmenu\MenuSliceFormController');
}
/**
* Take over core menu admin page
*
* hook_menu_alter()
*
* TODO - should be an admin toggle for this setting
*/
function bigmenu_menu_alter(&$items) {
$items['admin/structure/menu/manage/%menu']['page arguments'] = array('bigmenu_overview_form', 4);
$items['admin/structure/menu/manage/%menu']['file'] = 'bigmenu.admin.inc';
$items['admin/structure/menu/manage/%menu']['file path'] = drupal_get_path('module', 'bigmenu');
}
/**
* Implemenation of hook_theme().
*/
function bigmenu_theme() {
return array(
'bigmenu_overview_form' => array(
'file' => 'bigmenu.admin.inc',
'arguments' => array('form' => NULL),
'render element' => 'form',
),
);
}