function panopoly_widgets_field_settings_form in Panopoly Widgets 7
Implements hook_field_settings_form()
File
- ./
panopoly_widgets.spotlight.inc, line 64 - A specification for the custom spotlight entity that is part of Panopoly Widgets
Code
function panopoly_widgets_field_settings_form($field, $instance, $has_data) {
$form = array();
$defaults = field_info_field_settings($field['type']);
$settings = array_merge($defaults, $field['settings']);
$scheme_options = array();
foreach (file_get_stream_wrappers(STREAM_WRAPPERS_WRITE_VISIBLE) as $scheme => $stream_wrapper) {
$scheme_options[$scheme] = $stream_wrapper['name'];
}
$form['uri_scheme'] = array(
'#type' => 'radios',
'#title' => t('Upload destination'),
'#options' => $scheme_options,
'#default_value' => $settings['uri_scheme'],
'#description' => t('Select where the final files should be stored. Private file storage has significantly more overhead than public files, but allows restricted access to files within this field.'),
);
// When the user sets the scheme on the UI, even for the first time, it's
// updating a field because fields are created on the "Manage fields"
// page. So image_field_update_field() can handle this change.
$form['default_image'] = array(
'#title' => t('Default image'),
'#type' => 'managed_file',
'#description' => t('If no image is uploaded, this image will be shown on display.'),
'#default_value' => $field['settings']['default_image'],
'#upload_location' => $settings['uri_scheme'] . '://default_images/',
);
return $form;
}