You are here

function nd_field_default_form_properties in Node displays 6

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

1 call to nd_field_default_form_properties()
nd_add_fields in includes/nd.display.inc
Add fields to display overview form.

File

includes/nd.display.inc, line 212
Display overview form.

Code

function nd_field_default_form_properties($build_mode = NULL) {
  $field = array(
    'label' => array(
      'format' => array(
        '#type' => 'select',
        '#options' => nd_label_options($build_mode),
        '#default_value' => ND_DEFAULT_LABEL_FORMAT,
      ),
    ),
    'format' => array(
      '#type' => 'select',
      '#options' => array(),
      '#default_value' => ND_DEFAULT_FORMAT,
    ),
    'region' => array(
      '#type' => 'select',
      '#options' => nd_regions($build_mode),
      '#default_value' => ND_DEFAULT_REGION,
      '#attributes' => array(
        'class' => 'field-region-select field-region-' . ND_DEFAULT_REGION,
      ),
    ),
  );

  // If build mode is not empty, this means we're looking at
  // a content type which has no cck fields defined. Add
  // nd_weight and build mode key to the default field array
  // so the draghandling & formatters start working.
  if (!empty($build_mode)) {
    $field['nd_weight'] = array(
      '#type' => 'weight',
      '#default_value' => -19,
      '#delta' => 20,
    );
    $field[$build_mode] = array(
      'label' => array(
        'format' => array(
          '#type' => 'select',
          '#options' => nd_label_options($build_mode),
          '#default_value' => 'hidden',
        ),
      ),
      'format' => array(
        '#type' => 'select',
        '#options' => array(),
        '#default_value' => 'default',
      ),
      'region' => array(
        '#type' => 'select',
        '#options' => nd_regions($build_mode),
        '#default_value' => '',
        '#attributes' => array(
          'class' => 'field-region-select field-region-disabled',
        ),
      ),
    );
  }
  return $field;
}