1 taxonomy.module taxonomy_entity_info()

Implements hook_entity_info().

File

core/modules/taxonomy/taxonomy.module, line 82
Enables the organization of content into categories.

Code

function taxonomy_entity_info() {
  $entity_info = array(
    'taxonomy_term' => array(
      'label' => t('Taxonomy term'),
      'bundle label' => t('Vocabulary'),
      'entity class' => 'TaxonomyTerm',
      'controller class' => 'TaxonomyTermController',
      'base table' => 'taxonomy_term_data',
      'token type' => 'term',
      'fieldable' => TRUE,
      'redirect support' => TRUE,
      'entity keys' => array(
        'id' => 'tid',
        'bundle' => 'vocabulary',
      ),
      'bundle keys' => array(
        'bundle' => 'machine_name',
      ),
      'bundles' => array(),
      'view modes' => array(
        // @todo Display mode for display as a field (when attached to nodes etc).
        'full' => array(
          'label' => t('Taxonomy term page'),
          'custom settings' => FALSE,
        ),
        'token' => array(
          'label' => t('Tokens'),
          'custom settings' => FALSE,
        ),
      ),
    ),
  );

  // If the cache table has been created, then enable entity caching.
  if (db_table_exists('cache_entity_taxonomy_term')) {
    $entity_info['taxonomy_term']['entity cache'] = TRUE;
    $entity_info['taxonomy_term']['field cache'] = FALSE;
  }

  foreach (taxonomy_vocabulary_load_multiple(FALSE) as $machine_name => $vocabulary) {
    $entity_info['taxonomy_term']['bundles'][$machine_name] = array(
      'label' => $vocabulary->name,
      'admin' => array(
        'path' => 'admin/structure/taxonomy/%taxonomy_vocabulary',
        'real path' => 'admin/structure/taxonomy/' . $machine_name,
        'bundle argument' => 3,
        'access arguments' => array('administer taxonomy'),
      ),
    );
  }

  return $entity_info;
}