You are here

function notifications_tags_vocabularies in Notifications 5

Same name and namespace in other branches
  1. 6.4 notifications_tags/notifications_tags.module \notifications_tags_vocabularies()
  2. 6 notifications_tags/notifications_tags.module \notifications_tags_vocabularies()
  3. 6.2 notifications_tags/notifications_tags.module \notifications_tags_vocabularies()
  4. 6.3 notifications_tags/notifications_tags.module \notifications_tags_vocabularies()

Get list of allowed vocabularies

Parameters

$field: Optional field to retrieve as array value. If empty the whole vocalubary object will be returned.

2 calls to notifications_tags_vocabularies()
notifications_tags_form_alter in notifications_tags/notifications_tags.module
Implementation of hook_form_alter().
notifications_tags_user_form in notifications_tags/notifications_tags.module
Returns the taxonomy subscription form
1 string reference to 'notifications_tags_vocabularies'
notifications_update_5 in ./notifications.install
Update content type and taxonomy options

File

notifications_tags/notifications_tags.module, line 203
Subscriptions to taxonomy terms

Code

function notifications_tags_vocabularies($field = NULL) {
  $allvocab = taxonomy_get_vocabularies();
  if ($allowed = variable_get('notifications_tags_vocabularies', array())) {
    $vocabularies = array();
    foreach (array_filter($allowed) as $vid) {
      $vocabularies[$vid] = $allvocab[$vid];
    }
  }
  else {
    $vocabularies = $allvocab;
  }
  if ($field) {
    $list = array();
    foreach ($vocabularies as $vid => $vocab) {
      $list[$vid] = $vocab->{$field};
    }
    return $list;
  }
  else {
    return $vocabularies;
  }
}