You are here

function power_menu_get_term_by_name_vocab in Power Menu 6

Same name and namespace in other branches
  1. 7 power_menu.module \power_menu_get_term_by_name_vocab()

This is a rewrite of taxonomy_get_term_by_name but it also uses the vocab id (vid)

Parameters

string $name:

int $vid:

1 call to power_menu_get_term_by_name_vocab()
_power_menu_form_menu_edit_item_submit in ./power_menu.forms.inc
Callback function when menu_edit_item form is being submitted

File

./power_menu.module, line 550
This module provides some additional menu features. The features are not actually new, but are part of other modules. it's though very cumbersome to creating a new menu item, because one has to go to all the different places to configure these…

Code

function power_menu_get_term_by_name_vocab($name, $vid) {
  $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE LOWER(t.name) = LOWER('%s') AND vid=%d", 't', 'tid'), array(
    trim($name),
    $vid,
  ));
  $result = array();
  while ($term = db_fetch_object($db_result)) {
    $result[] = $term;
  }
  return $result;
}