admin_menu.map.inc

  1. nittany7 modules/contrib/admin_menu/admin_menu.map.inc
  2. cis7 modules/contrib/admin_menu/admin_menu.map.inc
  3. mooc7 modules/contrib/admin_menu/admin_menu.map.inc

Implements hook_admin_menu_map() on behalf of core modules.

@todo Replace all/most of those API functions with direct DB queries; we only need the menu arguments (keys), not fully loaded objects.

Functions

Namesort descending Description
field_ui_admin_menu_map Implements hook_admin_menu_map() on behalf of Field UI module.
filter_admin_menu_map Implements hook_admin_menu_map() on behalf of Filter module.
menu_admin_menu_map Implements hook_admin_menu_map() on behalf of Menu module.
node_admin_menu_map Implements hook_admin_menu_map() on behalf of Node module.
taxonomy_admin_menu_map Implements hook_admin_menu_map() on behalf of Taxonomy module.
views_ui_admin_menu_map Implements hook_admin_menu_map() on behalf of Views UI module.

File

modules/contrib/admin_menu/admin_menu.map.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Implements hook_admin_menu_map() on behalf of core modules.
  5. *
  6. * @todo Replace all/most of those API functions with direct DB queries;
  7. * we only need the menu arguments (keys), not fully loaded objects.
  8. */
  9. /**
  10. * Implements hook_admin_menu_map() on behalf of Filter module.
  11. */
  12. function filter_admin_menu_map() {
  13. if (!user_access('administer filters')) {
  14. return;
  15. }
  16. $map['admin/config/content/formats/%filter_format'] = array(
  17. 'parent' => 'admin/config/content/formats',
  18. 'arguments' => array(
  19. array('%filter_format' => array_keys(filter_formats())),
  20. ),
  21. );
  22. return $map;
  23. }
  24. /**
  25. * Implements hook_admin_menu_map() on behalf of Menu module.
  26. */
  27. function menu_admin_menu_map() {
  28. if (!user_access('administer menu')) {
  29. return;
  30. }
  31. $map['admin/structure/menu/manage/%menu'] = array(
  32. 'parent' => 'admin/structure/menu',
  33. 'arguments' => array(
  34. array('%menu' => array_keys(menu_get_menus())),
  35. ),
  36. );
  37. return $map;
  38. }
  39. /**
  40. * Implements hook_admin_menu_map() on behalf of Node module.
  41. */
  42. function node_admin_menu_map() {
  43. if (!user_access('administer content types')) {
  44. return;
  45. }
  46. $map['admin/structure/types/manage/%node_type'] = array(
  47. 'parent' => 'admin/structure/types',
  48. 'arguments' => array(
  49. array('%node_type' => array_keys(node_type_get_types())),
  50. ),
  51. );
  52. return $map;
  53. }
  54. /**
  55. * Implements hook_admin_menu_map() on behalf of Field UI module.
  56. */
  57. function field_ui_admin_menu_map() {
  58. $map = array();
  59. foreach (entity_get_info() as $obj_type => $info) {
  60. foreach ($info['bundles'] as $bundle_name => $bundle_info) {
  61. if (isset($bundle_info['admin'])) {
  62. $arguments = array();
  63. switch ($obj_type) {
  64. case 'comment':
  65. $fields = array();
  66. foreach (field_info_instances($obj_type, $bundle_name) as $field) {
  67. $fields[] = $field['field_name'];
  68. }
  69. // @todo Make Comment module expose the original node type bundle,
  70. // pretty please.
  71. if (drupal_substr($bundle_name, 0, 13) == 'comment_node_') {
  72. $bundle_name = drupal_substr($bundle_name, 13);
  73. }
  74. // @todo Doesn't work yet. Why?
  75. $arguments = array(
  76. '%comment_node_type' => array($bundle_name),
  77. '%field_ui_menu' => $fields,
  78. );
  79. break;
  80. case 'node':
  81. $fields = array();
  82. foreach (field_info_instances($obj_type, $bundle_name) as $field) {
  83. $fields[] = $field['field_name'];
  84. }
  85. $arguments = array(
  86. '%node_type' => array($bundle_name),
  87. '%field_ui_menu' => $fields,
  88. );
  89. break;
  90. case 'taxonomy_term':
  91. $fields = array();
  92. foreach (field_info_instances($obj_type, $bundle_name) as $field) {
  93. $fields[] = $field['field_name'];
  94. }
  95. // Map machine_name to vid.
  96. $arguments = array(
  97. '%taxonomy_vocabulary_machine_name' => array($bundle_name),
  98. '%field_ui_menu' => $fields,
  99. );
  100. break;
  101. case 'user':
  102. $arguments = array(
  103. '%field_ui_menu' => array_keys(field_info_fields('user')),
  104. );
  105. break;
  106. }
  107. if (!empty($arguments)) {
  108. $path = $bundle_info['admin']['path'];
  109. $map["$path/fields/%field_ui_menu"]['parent'] = "$path/fields";
  110. $map["$path/fields/%field_ui_menu"]['arguments'][] = $arguments;
  111. }
  112. }
  113. }
  114. }
  115. return $map;
  116. }
  117. /**
  118. * Implements hook_admin_menu_map() on behalf of Taxonomy module.
  119. */
  120. function taxonomy_admin_menu_map() {
  121. if (!user_access('administer taxonomy')) {
  122. return;
  123. }
  124. $map['admin/structure/taxonomy/%taxonomy_vocabulary_machine_name'] = array(
  125. 'parent' => 'admin/structure/taxonomy',
  126. 'arguments' => array(
  127. array('%taxonomy_vocabulary_machine_name' => array_keys(taxonomy_vocabulary_get_names())),
  128. ),
  129. );
  130. return $map;
  131. }
  132. /**
  133. * Implements hook_admin_menu_map() on behalf of Views UI module.
  134. */
  135. function views_ui_admin_menu_map() {
  136. if (!user_access('administer views')) {
  137. return;
  138. }
  139. $views = array();
  140. foreach (views_get_enabled_views() as $name => $view) {
  141. $views[] = $name;
  142. }
  143. if (empty($views)) {
  144. return;
  145. }
  146. $map['admin/structure/views/view/%views_ui_cache'] = array(
  147. 'parent' => 'admin/structure/views',
  148. 'arguments' => array(
  149. array('%views_ui_cache' => $views),
  150. ),
  151. );
  152. return $map;
  153. }