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