public function ButtonFieldImage::settingsForm in Button Field 8
Same name in this branch
- 8 src/Plugin/Field/FieldFormatter/ButtonFieldImage.php \Drupal\button_field\Plugin\Field\FieldFormatter\ButtonFieldImage::settingsForm()
- 8 src/Plugin/Field/FieldWidget/ButtonFieldImage.php \Drupal\button_field\Plugin\Field\FieldWidget\ButtonFieldImage::settingsForm()
@todo Provide a file upload element.
Overrides WidgetBase::settingsForm
File
- src/
Plugin/ Field/ FieldWidget/ ButtonFieldImage.php, line 40 - Contains Drupal\button_field\Plugin\Field\FieldWidget\ButtonFieldImage.
Class
- ButtonFieldImage
- Plugin implementation of the 'button html' widget.
Namespace
Drupal\button_field\Plugin\Field\FieldWidgetCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$element = parent::settingsForm($form, $form_state);
$element['image_path'] = array(
'#type' => 'textfield',
'#title' => t('Image path'),
'#default_value' => $this
->getSetting('image_path'),
'#required' => TRUE,
);
$element['alt_text'] = array(
'#type' => 'textfield',
'#title' => t('Alt text'),
'#default_value' => $this
->getSetting('alt_text') ?: $this->fieldDefinition
->getLabel(),
'#required' => TRUE,
);
$element['title_text'] = array(
'#type' => 'textfield',
'#title' => t('Title text'),
'#default_value' => $this
->getSetting('title_text'),
'#required' => FALSE,
);
return $element;
}