class Notifications_Taxonomy_Term_Multiple_Subscription in Notifications 7
Subscription to simple taxonomy term
Hierarchy
- class \Notifications_Subscription_Multiple extends \Notifications_Subscription
Expanded class hierarchy of Notifications_Taxonomy_Term_Multiple_Subscription
1 string reference to 'Notifications_Taxonomy_Term_Multiple_Subscription'
- notifications_tags_notifications in notifications_tags/
notifications_tags.module - Implementation of hook_notifications().
File
- notifications_tags/
notifications_tags.inc, line 260 - Drupal Notifications Framework - Default class file
View source
class Notifications_Taxonomy_Term_Multiple_Subscription extends Notifications_Subscription_Multiple {
/**
* Get proper name
*/
public function get_name() {
if (isset($this->name)) {
return $this->name;
}
elseif ($terms = $this
->get_fields()) {
foreach ($terms as $term_field) {
$names[] = $term_field
->get_name();
}
return t('Content tagged with @terms', array(
'@terms' => implode(', ', $names),
));
}
else {
parent::get_name();
}
}
/**
* Add term object
*/
public function add_term($term) {
return $this
->add_field('term:tid', $term->tid);
}
/**
* Add term by name (and optional vid)
*/
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;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Notifications_Subscription_Multiple:: |
function | Check all fields are there and they have a value. In this case we need at least the same fields that the type fields has | ||
Notifications_Subscription_Multiple:: |
function | Map field to its right position in this subscription. As fields have no specific position it will be the next one | ||
Notifications_Taxonomy_Term_Multiple_Subscription:: |
public | function | Add term object | |
Notifications_Taxonomy_Term_Multiple_Subscription:: |
public | function | Add term by name (and optional vid) | |
Notifications_Taxonomy_Term_Multiple_Subscription:: |
public | function | Get proper name |