You are here

function ds_field_default_form_properties in Display Suite 6

Same name and namespace in other branches
  1. 6.3 includes/ds.display.inc \ds_field_default_form_properties()
  2. 6.2 includes/ds.display.inc \ds_field_default_form_properties()

Function to load default form properties for a field in a context

1 call to ds_field_default_form_properties()
ds_fields_display_form in includes/ds.display.inc
Add fields to display overview form.

File

includes/ds.display.inc, line 698
Display overview form.

Code

function ds_field_default_form_properties($build_mode) {
  $field = array(
    'label' => array(
      'format' => array(
        '#title' => t('Label position'),
        '#type' => 'select',
        '#options' => ds_label_options(),
        '#default_value' => DS_DEFAULT_LABEL_FORMAT,
        '#description' => t('Position of the label'),
        '#attributes' => array(
          'class' => 'ds-label-change',
        ),
      ),
    ),
    'format' => array(
      '#title' => t('Field format'),
      '#type' => 'select',
      '#options' => array(),
      '#default_value' => DS_DEFAULT_FORMAT,
      '#description' => t('Hide the label or select a style.'),
      '#attributes' => array(
        'class' => 'ds-format-change',
      ),
    ),
    'css-class' => array(
      '#title' => t('Field style'),
      '#type' => 'select',
      '#multiple' => TRUE,
      '#size' => 5,
      '#options' => ds_styles('fields'),
      '#default_value' => array(),
      '#description' => t('Select styles to apply to this field.'),
      '#attributes' => array(
        'class' => 'ds-style-change',
      ),
    ),
    'region' => array(
      '#type' => 'select',
      '#options' => ds_regions(variable_get('ds_build_mode_' . $build_mode, 'all')),
      '#default_value' => DS_DEFAULT_REGION,
      '#attributes' => array(
        'class' => 'field-region-select',
      ),
    ),
  );

  // If build mode is not empty, this means we're looking at
  // a content type which has no cck fields defined. Add
  // ds_weight and build mode key to the default field array
  // so the draghandling & formatters start working.
  if (!empty($build_mode)) {
    $field['ds_weight'] = array(
      '#type' => 'weight',
      '#default_value' => DS_DEFAULT_WEIGHT,
      '#delta' => 100,
    );
    $field[$build_mode] = array(
      'label' => array(
        'format' => array(
          '#title' => t('Label position'),
          '#type' => 'select',
          '#options' => ds_label_options(),
          '#default_value' => DS_DEFAULT_LABEL_FORMAT,
          '#description' => t('Hide the label or select a style.'),
          '#attributes' => array(
            'class' => 'ds-label-change',
          ),
        ),
      ),
      'format' => array(
        '#title' => t('Field format'),
        '#type' => 'select',
        '#options' => array(),
        '#default_value' => DS_DEFAULT_FORMAT,
        '#description' => t('Select how this field will be displayed.'),
        '#attributes' => array(
          'class' => 'ds-format-change',
        ),
      ),
      'css-class' => array(
        '#title' => t('Field style'),
        '#type' => 'select',
        '#multiple' => TRUE,
        '#options' => ds_styles('fields'),
        '#default_value' => array(),
        '#description' => t('Select styles to apply to this field.'),
        '#attributes' => array(
          'class' => 'ds-style-change',
        ),
      ),
      'region' => array(
        '#type' => 'select',
        '#options' => ds_regions(variable_get('ds_build_mode_' . $build_mode, 'all')),
        '#default_value' => DS_DEFAULT_WEIGHT,
        '#attributes' => array(
          'class' => 'field-region-select',
        ),
      ),
    );
  }
  return $field;
}