You are here

crumbs.menu.inc in Crumbs, the Breadcrumbs suite 6

File

plugins/crumbs.menu.inc
View source
<?php

/**
 * Implementation of hook_crumbs_plugins()
 */
function menu_crumbs_plugins() {
  return array(
    'hierarchy' => new _menu_CrumbsPlugin__hierarchy(),
    'link_title' => new _menu_CrumbsPlugin__link_title(),
    'admin' => new _menu_CrumbsPlugin__admin(),
  );
}
class _menu_CrumbsPlugin__hierarchy {
  function define($h) {
    $q = db_query($sql = "SELECT menu_name, title FROM {menu_custom}");
    $titles = array();
    while ($row = db_fetch_object($q)) {
      $h
        ->addRule($row->menu_name, $row->title);
    }
  }
  function findParent($path, $item) {
    $q = db_query($sql = "\n      SELECT\n        parent.link_path parent_path,\n        parent.menu_name menu_name\n      FROM\n        {menu_links} parent\n        INNER JOIN {menu_links} child ON (parent.mlid = child.plid)\n      WHERE child.link_path = '%s'\n      GROUP BY menu_name\n    ", $path);
    $candidates = array();
    while ($row = db_fetch_object($q)) {
      $candidates[$row->menu_name] = $row->parent_path;
    }
    return $candidates;
  }

}
class _menu_CrumbsPlugin__link_title {
  function define($h) {
    $q = db_query($sql = "SELECT menu_name, title FROM {menu_custom}");
    $titles = array();
    while ($row = db_fetch_object($q)) {
      $h
        ->addRule($row->menu_name, $row->title);
    }
  }
  function findTitle($path, $item) {
    $q = db_query($sql = "\n      SELECT\n        link_title,\n        menu_name\n      FROM\n        {menu_links}\n      WHERE link_path = '%s'\n      GROUP BY menu_name\n    ", $path);
    $titles = array();
    while ($row = db_fetch_object($q)) {
      $titles[$row->menu_name] = $row->link_title;
    }
    return $titles;
  }

}
class _menu_CrumbsPlugin__admin {

  /**
   * Router path 'admin/build/menu-customize/%'.
   */
  function findParent__admin_build_menu_customize__($path, $item) {
    return "admin/build/menu";
  }

}

Functions

Namesort descending Description
menu_crumbs_plugins Implementation of hook_crumbs_plugins()

Classes