function field_collection_field_formatter_settings_form in Field collection 7
Implements hook_field_formatter_settings_form().
File
- ./
field_collection.module, line 878 - Module implementing field collection field type.
Code
function field_collection_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$elements = array();
if ($display['type'] !== 'field_collection_fields') {
$elements['add'] = array(
'#type' => 'textfield',
'#title' => t('Add link title'),
'#default_value' => $settings['add'],
'#description' => t('Leave the title empty, to hide the link.'),
);
$elements['edit'] = array(
'#type' => 'textfield',
'#title' => t('Edit link title'),
'#default_value' => $settings['edit'],
'#description' => t('Leave the title empty, to hide the link.'),
);
$elements['translate'] = array(
'#type' => 'textfield',
'#title' => t('Translate link title'),
'#default_value' => isset($settings['translate']) ? $settings['translate'] : '',
'#description' => t('Leave the title empty, to hide the link.'),
'#access' => field_collection_item_is_translatable(),
);
$elements['delete'] = array(
'#type' => 'textfield',
'#title' => t('Delete link title'),
'#default_value' => $settings['delete'],
'#description' => t('Leave the title empty, to hide the link.'),
);
$elements['description'] = array(
'#type' => 'checkbox',
'#title' => t('Show the field description beside the add link.'),
'#default_value' => $settings['description'],
'#description' => t('If enabled and the add link is shown, the field description is shown in front of the add link.'),
);
}
// Add a select form element for view_mode if viewing the rendered
// field_collection.
if ($display['type'] !== 'field_collection_list') {
$entity_type = entity_get_info('field_collection_item');
$options = array();
foreach ($entity_type['view modes'] as $mode => $info) {
$options[$mode] = $info['label'];
}
$elements['view_mode'] = array(
'#type' => 'select',
'#title' => t('View mode'),
'#options' => $options,
'#default_value' => $settings['view_mode'],
'#description' => t('Select the view mode'),
);
}
return $elements;
}