protected function RangeItemBase::fieldSettingsFormSubElementPrefixSuffix in Range 8
Helper method. Builds settings fieldsets for the FROM/TO values.
Parameters
string $title: Fieldset title.
string $element_name: Form element machine name.
Return value
array FROM/TO instance settings fieldset.
1 call to RangeItemBase::fieldSettingsFormSubElementPrefixSuffix()
- RangeItemBase::fieldSettingsForm in src/
Plugin/ Field/ FieldType/ RangeItemBase.php - Returns a form for the field-level settings.
File
- src/
Plugin/ Field/ FieldType/ RangeItemBase.php, line 120
Class
- RangeItemBase
- Base class for 'range' configurable field types.
Namespace
Drupal\range\Plugin\Field\FieldTypeCode
protected function fieldSettingsFormSubElementPrefixSuffix($title, $element_name) {
$element = [];
$element[$element_name] = [
'#type' => 'fieldset',
'#title' => $title,
];
$element[$element_name]['prefix'] = [
'#type' => 'textfield',
'#title' => $this
->t('Prefix'),
'#default_value' => $this
->getSetting($element_name)['prefix'],
'#size' => 60,
'#description' => $this
->t("Define a string that should be prefixed to the value, like '\$ ' or '€ '. Leave blank for none."),
];
$element[$element_name]['suffix'] = [
'#type' => 'textfield',
'#title' => $this
->t('Suffix'),
'#default_value' => $this
->getSetting($element_name)['suffix'],
'#size' => 60,
'#description' => $this
->t("Define a string that should be suffixed to the value, like ' m', ' kb/s'. Leave blank for none."),
];
return $element;
}