content_menu.api.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. *
  4. * PERMISSIONS introduced by this module:
  5. *
  6. * administer system menus
  7. * Allows a user to show/list _all_ menus on the menu overview admin page.
  8. * Users without this permission are not shown the content_menu_special_menus
  9. * (variable details see below).
  10. *
  11. *
  12. *
  13. * SYSTEM VARIABLES of this module that can be changed:
  14. * (There's currently no config interface to set them, but you can do that
  15. * manually or programmatically)
  16. *
  17. * content_menu_add_existing_content_url
  18. * URL of the "select existing content" page to use when creating a new menu
  19. * item that is linking to "existing content".
  20. *
  21. * content_menu_add_existing_content_view
  22. * VIEWNAME[:DISPLAYNAME] of the view (if any) that should be used
  23. * when creating a new menu item that is linking to "existing content".
  24. * An "nid" field of this field based view[/display] is changed to be used as
  25. * "select" link to select existing content for the new menu item to link to.
  26. *
  27. * content_menu_special_menus
  28. * Array of menu machine names that are considered special/system menus, and
  29. * are hence not altered by content_menu, and not shown to users without the
  30. * new 'administer system menus' permission.
  31. * Default: array('management', 'user-menu', 'navigation', 'devel'));
  32. *
  33. * content_menu_alter_all_menus
  34. * Boolean flag to state whether all menus should be altered to have to
  35. * improved interface, including those listed in the variable
  36. * content_menu_special_menus.
  37. * Default: FALSE (to let system menus be untouched, 'just in case').
  38. *
  39. *
  40. */
  41. /**
  42. * Extend the target types for a new menu item.
  43. *
  44. * @param $target_types Array
  45. * Array of menu item target types that you can extend.
  46. * The key is a machine name of a target type (alphanumerical char, _)
  47. * The value is an array containing the following entries:
  48. * - label => translated label to display in the interface
  49. * - handler => full name of a handler function to use, with the signature
  50. * ...(&$form, &$form_state, &$item [, $arg_1, ..., $arg_n])
  51. * - arguments => array of arg_name=>arg_value (optional),
  52. * each argument is passed to handler callback function.
  53. * - clean_menu_save_message => flag whether the existing message
  54. * "Your configuration has been saved"
  55. * should be removed (TRUE) or not (FALSE).
  56. *
  57. * @param $context Array
  58. * Array with context information. Currently the following key is used:
  59. * 'menu_name' => machine name of the menu the target types are assembled.
  60. *
  61. */
  62. function hook_menu_item_target_types_alter(&$target_types, &$context) {
  63. $target_types['url'] = array(
  64. 'label' => t('URL'),
  65. 'handler' => 'content_menu_menu_form_handler_url',
  66. 'clean_menu_save_message' => TRUE
  67. );
  68. }
  69. /**
  70. * Alter a menu item's form element in the menu item administration.
  71. *
  72. * @param $el Array The form element of the menu item to alter.
  73. */
  74. function _content_menu_menu_item_element_alter(&$el) {
  75. module_load_include('inc', 'content_menu', 'content_menu.menu_admin');
  76. _content_menu_menu_item_element_alter($el);
  77. }