You are here

function nodereferrer_field_formatter_settings_form in NodeReferrer 7

Implements hook_field_formatter_settings_form().

File

./nodereferrer.module, line 385
Defines a field type for backlinking referencing nodes.

Code

function nodereferrer_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
  $display = $instance['display'][$view_mode];
  $settings = $display['settings'];
  if ($display['type'] === 'nodereferrer_node') {
    $entity_info = entity_get_info('node');
    $modes = $entity_info['view modes'];
    $options = array();
    foreach ($modes as $name => $mode) {
      $options[$name] = $mode['label'];
    }
    $element['nodereferrer_view_mode'] = array(
      '#title' => t('View mode'),
      '#type' => 'select',
      '#options' => $options,
      '#default_value' => $settings['nodereferrer_view_mode'],
    );
  }
  $element['prefix_suffix'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display prefix and suffix.'),
    '#default_value' => $settings['prefix_suffix'],
  );
  return $element;
}