1 taxonomy.module taxonomy_field_extra_fields()

Implements hook_field_extra_fields().

File

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

Code

function taxonomy_field_extra_fields() {
  $return = array();
  $info = entity_get_info('taxonomy_term');
  foreach (array_keys($info['bundles']) as $bundle) {
    $return['taxonomy_term'][$bundle] = array(
      'form' => array(
        'name' => array(
          'label' => t('Name'),
          'description' => t('Term name textfield'),
          'weight' => -5,
        ),
        'description' => array(
          'label' => t('Description'),
          'description' => t('Term description textarea'),
          'weight' => 0,
        ),
      ),
      'display' => array(
        'description' => array(
          'label' => t('Description'),
          'description' => t('Term description'),
          'weight' => 0,
        ),
      ),
    );

    // If the Language module is enabled and the bundle has multilingual
    // support, then also add the language select.
    $vocabulary = taxonomy_vocabulary_load($bundle);
    if (module_exists('language') && $vocabulary->language == TAXONOMY_LANGUAGE_ENABLED) {
      $return['taxonomy_term'][$bundle]['form'] += array(
        'langcode' => array(
          'label' => t('Language'),
          'description' => t('Term language'),
          'weight' => 0,
        ),
      );
      $return['taxonomy_term'][$bundle]['display'] += array(
        'langcode' => array(
          'label' => t('Language'),
          'description' => t('Term language'),
          'weight' => 0,
        ),
      );
    }
  }

  return $return;
}