You are here

function any_menu_path_view_paths in Any Menu Path 7

A page where the user can view the overridden menu paths.

1 string reference to 'any_menu_path_view_paths'
any_menu_path_menu in ./any_menu_path.module
Implements hook_menu().

File

./any_menu_path.module, line 157
Allows to add menu paths that don't exist on the site.

Code

function any_menu_path_view_paths() {
  $rows = array();
  $header = array(
    array(
      'data' => t('Menu Title'),
      'sort' => 'asc',
    ),
    array(
      'data' => t('Path'),
    ),
    array(
      'data' => t('Edit'),
    ),
  );
  $any_menus = variable_get('any_menu_path', array());
  foreach ($any_menus as $mlid) {
    $menu_items = db_select('menu_links', 'ml')
      ->fields('ml', array(
      'link_path',
      'link_title',
    ))
      ->condition('mlid', $mlid)
      ->execute();
    foreach ($menu_items as $menu_item) {
      $rows[] = array(
        'data' => array(
          check_plain($menu_item->link_title),
          check_plain($menu_item->link_path),
          l(t('edit'), 'admin/structure/menu/item/' . $mlid . '/edit', array(
            'query' => drupal_get_destination(),
          )),
        ),
      );
    }
  }
  $html = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'sticky' => TRUE,
    'empty' => t('No menu links overridden with the Any Menu Path module...'),
  ));
  return $html;
}