1 image.field.inc | image_field_settings_form($field, $instance) |
Implements hook_field_settings_form().
File
- core/
modules/ image/ image.field.inc, line 41 - Implement an image field, based on the file module's file field.
Code
function image_field_settings_form($field, $instance) {
$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.'),
);
$form['default_image'] = array(
'#element_validate' => array('_image_field_default_image_validate'),
'#default_scheme' => $field['settings']['uri_scheme'],
'#target' => array('field', 'settings', 'default_image'),
);
$form['default_image']['file'] = array(
'#title' => t('Default image'),
'#type' => 'file',
'#description' => t('If no image is uploaded, this image will be shown on display.'),
);
if ($field['settings']['default_image']) {
$link = l(basename($field['settings']['default_image']), file_create_url($field['settings']['default_image']), array('attributes' => array('target' => '_blank')));
$form['default_image']['file']['#description'] .= '<br />' . t('Current image: !link', array('!link' => $link));
$form['default_image']['remove'] = array(
'#type' => 'checkbox',
'#title' => t('Remove default image'),
);
}
return $form;
}