function taxonomy_entity_info

Implements hook_entity_info().

File

modules/taxonomy/taxonomy.module, line 91

Code

function taxonomy_entity_info() {
    $return = array(
        'taxonomy_term' => array(
            'label' => t('Taxonomy term'),
            'controller class' => 'TaxonomyTermController',
            'base table' => 'taxonomy_term_data',
            'uri callback' => 'taxonomy_term_uri',
            'fieldable' => TRUE,
            'entity keys' => array(
                'id' => 'tid',
                'bundle' => 'vocabulary_machine_name',
                'label' => 'name',
            ),
            'bundle keys' => array(
                'bundle' => 'machine_name',
            ),
            'bundles' => array(),
            'view modes' => array(
                // @todo View mode for display as a field (when attached to nodes etc).
'full' => array(
                    'label' => t('Taxonomy term page'),
                    'custom settings' => FALSE,
                ),
            ),
        ),
    );
    foreach (taxonomy_vocabulary_get_names() as $machine_name => $vocabulary) {
        $return['taxonomy_term']['bundles'][$machine_name] = array(
            'label' => $vocabulary->name,
            'admin' => array(
                'path' => 'admin/structure/taxonomy/%taxonomy_vocabulary_machine_name',
                'real path' => 'admin/structure/taxonomy/' . $machine_name,
                'bundle argument' => 3,
                'access arguments' => array(
                    'administer taxonomy',
                ),
            ),
        );
    }
    $return['taxonomy_vocabulary'] = array(
        'label' => t('Taxonomy vocabulary'),
        'controller class' => 'TaxonomyVocabularyController',
        'base table' => 'taxonomy_vocabulary',
        'entity keys' => array(
            'id' => 'vid',
            'label' => 'name',
        ),
        'fieldable' => FALSE,
    );
    return $return;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.