function field_collection_field_settings_form in Field collection 7
Implements hook_field_settings_form().
File
- ./
field_collection.module, line 485 - Module implementing field collection field type.
Code
function field_collection_field_settings_form($field, $instance) {
$form['hide_blank_items'] = array(
'#type' => 'checkbox',
'#title' => t('Hide blank items'),
'#default_value' => $field['settings']['hide_blank_items'],
'#description' => t('Ordinarily a new blank item will be added to unlimited cardinality fields whenever they appear in a form. Checking this will prevent the blank item from appearing if the field already contains data.'),
'#weight' => 10,
'#states' => array(
// Show the setting if the cardinality is -1.
'visible' => array(
':input[name="field[cardinality]"]' => array(
'value' => '-1',
),
),
),
);
$form['hide_initial_item'] = array(
'#type' => 'checkbox',
'#title' => t('Hide initial item'),
'#default_value' => $field['settings']['hide_initial_item'],
'#description' => t('Prevent the default blank item from appearing even if the field has no data yet. If checked, the user must explicitly add the field collection.'),
'#weight' => 11,
'#states' => array(
// Show the setting if the cardinality is -1 and hide_blank_items is checked.
'visible' => array(
':input[name="field[cardinality]"]' => array(
'value' => '-1',
),
':input[name="field[settings][hide_blank_items]"]' => array(
'checked' => TRUE,
),
),
),
);
return $form;
}