You are here

function spaces_custom_menu in Spaces 5

Returns a custom label or weight for a given group & path.

Parameters

$path: A valid drupal path.

$gid: Optional group id. Will be assumed from spaces_gid() if omitted.

3 calls to spaces_custom_menu()
spaces_views_post_view in ./spaces.module
_spaces_core_block_book in spaces_core/spaces_core.module
Spaces version of the book nav block -- shows all root books in a group
_spaces_feature_menu_tree in ./spaces.module
Recurses down the menu cache and builds a menu tree for a given feature.

File

./spaces.module, line 1029

Code

function spaces_custom_menu($op = 'label', $path, $gid = null) {
  static $labels = array();
  static $weights = array();
  $gid = $gid ? $gid : spaces_gid();
  if (!isset($labels[$gid])) {
    $custom = db_fetch_object(db_query("SELECT labels, weights FROM {spaces_features_custom} WHERE gid = %d", $gid));
    $labels[$gid] = unserialize($custom->labels);
    $weights[$gid] = unserialize($custom->weights);
  }
  switch ($op) {
    case 'label':
      return $labels[$gid][$path] ? $labels[$gid][$path] : false;
      break;
    case 'weight':
      return $weights[$gid][$path] ? $weights[$gid][$path] : false;
      break;
  }
}