public function FixedTextFileUrl::settingsForm in Fixed text link formatter 8
Returns a form to configure settings for the formatter.
Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the formatter. The field_ui module takes care of handling submitted form values.
Parameters
array $form: The form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form elements for the formatter settings.
Overrides FormatterBase::settingsForm
File
- src/
Plugin/ Field/ FieldFormatter/ FixedTextFileUrl.php, line 39
Class
- FixedTextFileUrl
- Plugin implementation of the 'file_url_plain' formatter.
Namespace
Drupal\fixed_text_link_formatter\Plugin\Field\FieldFormatterCode
public function settingsForm(array $parentForm, FormStateInterface $form_state) {
$parentForm = parent::settingsForm($parentForm, $form_state);
$form['link_text'] = [
'#type' => 'textfield',
'#title' => $this
->t('Link text'),
'#default_value' => $this
->getLinkText(),
'#required' => TRUE,
];
$form['link_class'] = [
'#type' => 'textfield',
'#title' => $this
->t('Link class'),
'#default_value' => $this
->getLinkClass(),
'#required' => FALSE,
];
$form['open_in_new_window'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Open in a new window'),
'#default_value' => $this
->openLinkInNewWindow(),
];
return $form + $parentForm;
}