You are here

public function GeolocationTokenFormatter::settingsForm in Geolocation Field 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldFormatter/GeolocationTokenFormatter.php \Drupal\geolocation\Plugin\Field\FieldFormatter\GeolocationTokenFormatter::settingsForm()
  2. 8.2 src/Plugin/Field/FieldFormatter/GeolocationTokenFormatter.php \Drupal\geolocation\Plugin\Field\FieldFormatter\GeolocationTokenFormatter::settingsForm()

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/GeolocationTokenFormatter.php, line 41

Class

GeolocationTokenFormatter
Plugin implementation of the 'geolocation_token' formatter.

Namespace

Drupal\geolocation\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $settings = $this
    ->getSettings();
  $element['tokenized_text'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Tokenized text'),
    '#description' => $this
      ->t('Enter any text or HTML to be shown for each value. Tokens will be replaced as available. The "token" module greatly expands the number of available tokens as well as provides a comfortable token browser.'),
    '#default_value' => $settings['tokenized_text'],
  ];
  $element['token_help'] = $this
    ->getTokenHelp();
  return $element;
}