You are here

function field_collection_field_instance_settings_form in Field collection 7

Implements hook_field_instance_settings_form().

File

./field_collection.module, line 448
Module implementing field collection field type.

Code

function field_collection_field_instance_settings_form($field, $instance) {
  $element['fieldset'] = array(
    '#type' => 'fieldset',
    '#title' => t('Default value'),
    '#collapsible' => FALSE,
    // As field_ui_default_value_widget() does, we change the #parents so that
    // the value below is writing to $instance in the right location.
    '#parents' => array(
      'instance',
    ),
  );

  // Be sure to set the default value to NULL, e.g. to repair old fields
  // that still have one.
  $element['fieldset']['default_value'] = array(
    '#type' => 'value',
    '#value' => NULL,
  );
  $element['fieldset']['content'] = array(
    '#pre' => '<p>',
    '#markup' => t('To specify a default value, configure it via the regular default value setting of each field that is part of the field collection. To do so, go to the <a href="!url">Manage fields</a> screen of the field collection.', array(
      '!url' => url('admin/structure/field-collections/' . strtr($field['field_name'], array(
        '_' => '-',
      )) . '/fields'),
    )),
    '#suffix' => '</p>',
  );
  return $element;
}