function StringFormatter::settingsForm
Same name in other branches
- 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\StringFormatter::settingsForm()
- 8.9.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\StringFormatter::settingsForm()
- 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/StringFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\StringFormatter::settingsForm()
Overrides FormatterBase::settingsForm
1 call to StringFormatter::settingsForm()
- LanguageFormatter::settingsForm in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ LanguageFormatter.php
1 method overrides StringFormatter::settingsForm()
- LanguageFormatter::settingsForm in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ LanguageFormatter.php
File
-
core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ StringFormatter.php, line 92
Class
- StringFormatter
- Plugin implementation of the 'string' formatter.
Namespace
Drupal\Core\Field\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$form = parent::settingsForm($form, $form_state);
$entity_type = $this->entityTypeManager
->getDefinition($this->fieldDefinition
->getTargetEntityTypeId());
if ($entity_type->hasLinkTemplate('canonical')) {
$form['link_to_entity'] = [
'#type' => 'checkbox',
'#title' => $this->t('Link to the @entity_label', [
'@entity_label' => $entity_type->getLabel(),
]),
'#default_value' => $this->getSetting('link_to_entity'),
];
}
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.