1 taxonomy.module taxonomy_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state)

Implements hook_field_formatter_settings_form().

File

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

Code

function taxonomy_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];

  $element = array();

  switch ($display['type']) {
    case 'taxonomy_term_reference_rendered':
      $entity_info = entity_get_info('taxonomy_term');
      $modes = $entity_info['view modes'];
      $options = array('default' => t("Default"));
      foreach ($modes as $name => $mode) {
        $options[$name] = $mode['label'];
      }
      $element['view_mode'] = array(
        '#title' => t('Display mode'),
        '#type' => 'select',
        '#options' => $options,
        '#default_value' => $settings['view_mode'],
        // Never empty, so no #empty_option
      );
      break;
  }
  return $element;
}