public function StarRatingItem::fieldSettingsForm in Star Rating 8.4
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldType/StarRatingItem.php \Drupal\starrating\Plugin\Field\FieldType\StarRatingItem::fieldSettingsForm()
- 8.2 src/Plugin/Field/FieldType/StarRatingItem.php \Drupal\starrating\Plugin\Field\FieldType\StarRatingItem::fieldSettingsForm()
- 8.3 src/Plugin/Field/FieldType/StarRatingItem.php \Drupal\starrating\Plugin\Field\FieldType\StarRatingItem::fieldSettingsForm()
Returns a form for the field-level settings.
Invoked from \Drupal\field_ui\Form\FieldConfigEditForm to allow administrators to configure field-level settings.
Parameters
array $form: The form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface $form_state: The form state of the (entire) configuration form.
Return value
array The form definition for the field settings.
Overrides FieldItemBase::fieldSettingsForm
File
- src/
Plugin/ Field/ FieldType/ StarRatingItem.php, line 73
Class
- StarRatingItem
- Plugin implementation of the 'starrating' field type.
Namespace
Drupal\starrating\Plugin\Field\FieldTypeCode
public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
$element = [];
// The key of the element should be the setting name.
$element['max_value'] = [
'#title' => $this
->t('Maximum rating value'),
'#type' => 'select',
'#options' => [
1 => '1',
2 => '2',
3 => '3',
4 => '4',
5 => '5',
6 => '6',
7 => '7',
8 => '8',
9 => '9',
10 => '10',
],
'#default_value' => $this
->getSetting('max_value'),
];
return $element;
}