You are here

function notifications_tags_vocabularies in Notifications 6

Same name and namespace in other branches
  1. 5 notifications_tags/notifications_tags.module \notifications_tags_vocabularies()
  2. 6.4 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.

4 calls to notifications_tags_vocabularies()
notifications_tags_autocomplete in notifications_tags/notifications_tags.module
Helper function for term name autocompletion
notifications_tags_form_alter in notifications_tags/notifications_tags.module
Implementation of hook_form_alter().
notifications_tags_term_tid in notifications_tags/notifications_tags.module
Fields information, translate term name to tid
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 254
Subscriptions to taxonomy terms

Code

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

    // They're disallowed by default
    $vocabularies = array();
  }
  if ($field) {
    $list = array();
    foreach ($vocabularies as $vid => $vocab) {
      $list[$vid] = $vocab->{$field};
    }
    return $list;
  }
  else {
    return $vocabularies;
  }
}