public function FontawesomeIconpicker::settingsForm in Font Awesome Iconpicker 8
Same name in this branch
- 8 src/Plugin/Field/FieldFormatter/FontawesomeIconpicker.php \Drupal\fontawesome_iconpicker\Plugin\Field\FieldFormatter\FontawesomeIconpicker::settingsForm()
- 8 src/Plugin/Field/FieldWidget/FontawesomeIconpicker.php \Drupal\fontawesome_iconpicker\Plugin\Field\FieldWidget\FontawesomeIconpicker::settingsForm()
Returns a form to configure settings for the widget.
Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the widget. The field_ui module takes care of handling submitted form values.
Parameters
array $form: The form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form definition for the widget settings.
Overrides WidgetBase::settingsForm
File
- src/
Plugin/ Field/ FieldWidget/ FontawesomeIconpicker.php, line 37
Class
- FontawesomeIconpicker
- Plugin implementation of the 'fontawesome_iconpicker' widget.
Namespace
Drupal\fontawesome_iconpicker\Plugin\Field\FieldWidgetCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$elements = [];
$elements['type'] = [
'#type' => 'select',
'#title' => t('Type of Icon Picker'),
'#default_value' => $this
->getSetting('type'),
'#required' => TRUE,
'#options' => $this
->getIconPickerTypes(),
];
$elements['size'] = array(
'#type' => 'number',
'#min' => 0,
'#step' => 1,
'#title' => t('Field Size'),
'#description' => t('Select a field size.'),
'#default_value' => $this
->getSetting('size'),
);
$elements['placeholder'] = [
'#type' => 'textfield',
'#title' => t('Placeholder'),
'#default_value' => $this
->getSetting('placeholder'),
'#description' => t('Text that will be shown inside the field until a value is entered. This hint is usually a sample value or a brief description of the expected format.'),
];
return $elements;
}