You are here

function entity_metadata_taxonomy_vocabulary_get_properties in Entity API 7

Callback for getting vocabulary properties.

See also

entity_metadata_taxonomy_entity_info_alter()

1 string reference to 'entity_metadata_taxonomy_vocabulary_get_properties'
entity_metadata_taxonomy_entity_property_info in modules/taxonomy.info.inc
Implements hook_entity_property_info() on top of taxonomy module.

File

modules/callbacks.inc, line 351
Provides various callbacks for the whole core module integration.

Code

function entity_metadata_taxonomy_vocabulary_get_properties($vocabulary, array $options, $name) {
  switch ($name) {
    case 'term_count':
      $sql = "SELECT COUNT (1) FROM {taxonomy_term_data} td WHERE td.vid = :vid";
      return db_query($sql, array(
        ':vid' => $vocabulary->vid,
      ))
        ->fetchField();
  }
}