123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
- /**
- * Implementation of hook_menu().
- */
- function menu_editor_menu() {
- $items['admin/structure/menu/manage/%menu/poweredit'] = array(
- 'title' => 'Power Edit',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('menu_editor_overview_form', 4),
- // 'title callback' => 'menu_editor_overview_title',
- // 'title arguments' => array(3),
- 'access callback' => 'menu_editor_form_access',
- 'access arguments' => array(4),
- 'type' => MENU_LOCAL_TASK,
- 'file' => 'menu_editor.admin.inc',
- );
- return $items;
- }
- /**
- * Implements hook_permission().
- */
- function menu_editor_permission() {
- $menus = menu_get_menus(TRUE);
- $perm = array();
- foreach ($menus as $menu_machine_name => $menu_display_name) {
- $perm["menu edit $menu_machine_name"] = array(
- 'title' => t("Menu editor: Edit @menu", array('@menu' => $menu_display_name)),
- );
- }
- return $perm;
- }
- /**
- * @param array $menu
- *
- * @return bool
- */
- function menu_editor_form_access($menu) {
- return
- user_access('administer menu') ||
- user_access("menu edit $menu[menu_name]")
- ;
- }
- // function menu_editor_admin_menu() {
- // $result = db_query("SELECT * FROM {menu_custom} ORDER BY title");
- // $items = array();
- // while ($menu = db_fetch_array($result)) {
- // $items[] = array(
- // 'title' => $menu['title'],
- // 'path' => 'admin/build/menu-customize/'. $menu['menu_name'] . '/poweredit',
- // 'parent_path' => 'admin/build/menu/list',
- // 'weight' => 100,
- // );
- // }
- // return $items;
- // }
- /**
- * Implements hook_theme().
- *
- * @return array[]
- */
- function menu_editor_theme() {
- return array(
- 'menu_editor_overview_form' => array(
- 'file' => 'menu_editor.admin.inc',
- 'render element' => 'form',
- ),
- );
- }
- /**
- * Title callback for the menu overview page and links.
- *
- * @param array $menu
- *
- * @return string
- */
- function menu_editor_overview_title(array $menu) {
- return $menu['title'];
- }
- /**
- * @return string[]
- */
- function menu_editor_get_placeholders() {
- static $placeholders;
- if (!isset($placeholders)) {
- /* @see hook_menu_editor_placeholders() */
- $placeholders = module_invoke_all('menu_editor_placeholders');
- }
- return $placeholders;
- }
- /**
- * @param string $placeholder
- * @param string|int $mlid
- *
- * @return string
- */
- function menu_editor_get_path_for_placeholder($placeholder, $mlid) {
- $placeholders = menu_editor_get_placeholders();
- if (isset($placeholders[$placeholder])) {
- return str_replace('%mlid', $mlid, $placeholders[$placeholder]);
- }
- return $placeholder;
- }
|