You are here

function ds_extras_ds_field_settings_form in Display Suite 7

Same name and namespace in other branches
  1. 7.2 modules/ds_extras/includes/ds_extras.admin.inc \ds_extras_ds_field_settings_form()

Implements hook_ds_field_settings_form().

File

modules/ds_extras/ds_extras.admin.inc, line 508
Display Suite Extras administrative functions.

Code

function ds_extras_ds_field_settings_form($field) {
  $form = array();
  $entity_type = $field['entity_type'];
  $bundle = $field['bundle'];
  $view_mode = $field['view_mode'];
  $settings = isset($field['formatter_settings']) ? $field['formatter_settings'] : array();
  $view_modes = ds_entity_view_modes($entity_type);
  $form['info'] = array(
    '#markup' => t('Enter a label for the link for the view modes you want to switch to.<br />Leave empty to hide link. They will be localized.'),
  );
  foreach ($view_modes as $key => $value) {
    $view_mode_settings = field_view_mode_settings($entity_type, $bundle);
    $visible = !empty($view_mode_settings[$key]['custom_settings']);
    if ($visible) {
      $form[$key] = array(
        '#type' => 'textfield',
        '#default_value' => isset($settings[$key]) ? $settings[$key] : '',
        '#size' => 20,
        '#title' => check_plain($value['label']),
      );
    }
  }
  return $form;
}