public function EmailContactLinkFormatter::settingsForm in Email Contact 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/ EmailContactLinkFormatter.php, line 30
Class
- EmailContactLinkFormatter
- Plugin implementation of the 'email_contact_link' formatter.
Namespace
Drupal\email_contact\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$element = array();
$element['redirection_to'] = array(
'#type' => 'hidden',
'#value' => 'custom',
);
$element['custom_path'] = array(
'#type' => 'hidden',
'#value' => '',
);
$element['include_values'] = array(
'#title' => t('Display all field values in email body'),
'#type' => 'checkbox',
'#default_value' => $this
->getSetting('include_values'),
);
$element['default_message'] = array(
'#title' => t('Additional message in email body'),
'#type' => 'textfield',
'#default_value' => $this
->getSetting('default_message'),
);
$element['link_text'] = array(
'#title' => t('Link text'),
'#type' => 'textfield',
'#default_value' => $this
->getSettings()['link_text'],
);
if (\Drupal::moduleHandler()
->moduleExists('token')) {
$element['token_help'] = array(
'#theme' => 'token_tree_link',
'#token_types' => array(
'node',
),
);
}
return $element;
}