Same name and namespace in other branches
- 8.9.x core/modules/link/src/Plugin/Field/FieldType/LinkItem.php \Drupal\link\Plugin\Field\FieldType\LinkItem::fieldSettingsForm()
- 9 core/modules/link/src/Plugin/Field/FieldType/LinkItem.php \Drupal\link\Plugin\Field\FieldType\LinkItem::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
- core/
modules/ link/ src/ Plugin/ Field/ FieldType/ LinkItem.php, line 88
Class
- LinkItem
- Plugin implementation of the 'link' field type.
Namespace
Drupal\link\Plugin\Field\FieldTypeCode
public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
$element = [];
$element['link_type'] = [
'#type' => 'radios',
'#title' => $this
->t('Allowed link type'),
'#default_value' => $this
->getSetting('link_type'),
'#options' => [
static::LINK_INTERNAL => $this
->t('Internal links only'),
static::LINK_EXTERNAL => $this
->t('External links only'),
static::LINK_GENERIC => $this
->t('Both internal and external links'),
],
];
$element['title'] = [
'#type' => 'radios',
'#title' => $this
->t('Allow link text'),
'#default_value' => $this
->getSetting('title'),
'#options' => [
DRUPAL_DISABLED => $this
->t('Disabled'),
DRUPAL_OPTIONAL => $this
->t('Optional'),
DRUPAL_REQUIRED => $this
->t('Required'),
],
];
return $element;
}