public function EntityReferenceHierarchy::fieldSettingsForm in Entity Reference Hierarchy 3.x
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldType/EntityReferenceHierarchy.php \Drupal\entity_hierarchy\Plugin\Field\FieldType\EntityReferenceHierarchy::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 EntityReferenceItem::fieldSettingsForm
File
- src/
Plugin/ Field/ FieldType/ EntityReferenceHierarchy.php, line 85
Class
- EntityReferenceHierarchy
- Plugin implementation of the 'entity_reference_hierarchy' field type.
Namespace
Drupal\entity_hierarchy\Plugin\Field\FieldTypeCode
public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
$elements = parent::fieldSettingsForm($form, $form_state);
$elements['weight_min'] = [
'#type' => 'number',
'#title' => t('Minimum'),
'#default_value' => $this
->getSetting('weight_min'),
];
$elements['weight_max'] = [
'#type' => 'number',
'#title' => t('Maximum'),
'#default_value' => $this
->getSetting('weight_max'),
];
$elements['weight_label'] = [
'#type' => 'textfield',
'#title' => t('Weight Label'),
'#default_value' => $this
->getSetting('weight_label'),
'#description' => t('The weight of this child with respect to other children.'),
];
return $elements;
}