public function Notifications_Taxonomy_Term_Subscription::add_term_by_name in Notifications 7
Add term by name (and optional vid)
File
- notifications_tags/
notifications_tags.inc, line 225 - Drupal Notifications Framework - Default class file
Class
- Notifications_Taxonomy_Term_Subscription
- Subscription to simple taxonomy term
Code
public function add_term_by_name($name, $vid = NULL) {
$conditions = array(
'name' => trim($name),
);
if ($vid) {
$conditions['vid'] = $vid;
}
if ($terms = taxonomy_term_load_multiple(array(), $conditions)) {
$this
->add_term(reset($terms));
}
return $this;
}