function ImageItem::storageSettingsForm
Same name in other branches
- 9 core/modules/image/src/Plugin/Field/FieldType/ImageItem.php \Drupal\image\Plugin\Field\FieldType\ImageItem::storageSettingsForm()
- 8.9.x core/modules/image/src/Plugin/Field/FieldType/ImageItem.php \Drupal\image\Plugin\Field\FieldType\ImageItem::storageSettingsForm()
- 11.x core/modules/image/src/Plugin/Field/FieldType/ImageItem.php \Drupal\image\Plugin\Field\FieldType\ImageItem::storageSettingsForm()
Overrides FileItem::storageSettingsForm
File
-
core/
modules/ image/ src/ Plugin/ Field/ FieldType/ ImageItem.php, line 186
Class
- ImageItem
- Plugin implementation of the 'image' field type.
Namespace
Drupal\image\Plugin\Field\FieldTypeCode
public function storageSettingsForm(array &$form, FormStateInterface $form_state, $has_data) {
$element = [];
// We need the field-level 'default_image' setting, and $this->getSettings()
// will only provide the instance-level one, so we need to explicitly fetch
// the field.
$settings = $this->getFieldDefinition()
->getFieldStorageDefinition()
->getSettings();
$scheme_options = \Drupal::service('stream_wrapper_manager')->getNames(StreamWrapperInterface::WRITE_VISIBLE);
$element['uri_scheme'] = [
'#type' => 'radios',
'#title' => $this->t('Upload destination'),
'#options' => $scheme_options,
'#default_value' => $settings['uri_scheme'],
'#description' => $this->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.'),
];
// Add default_image element.
static::defaultImageForm($element, $settings);
$element['default_image']['#description'] = $this->t('If no image is uploaded, this image will be shown on display.');
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.