You are here

public function GeocodeFormatter::settingsForm in Geocoder 8.2

Same name and namespace in other branches
  1. 8.3 modules/geocoder_field/src/Plugin/Field/FieldFormatter/GeocodeFormatter.php \Drupal\geocoder_field\Plugin\Field\FieldFormatter\GeocodeFormatter::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 GeocodeFormatterBase::settingsForm

File

modules/geocoder_field/src/Plugin/Field/FieldFormatter/GeocodeFormatter.php, line 39

Class

GeocodeFormatter
Plugin implementation of the Geocode formatter.

Namespace

Drupal\geocoder_field\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  $element = parent::settingsForm($form, $form_state);

  // Filter out the Geocoder Plugins that are not compatible with the Geocode
  // Formatter action.
  $element['plugins'] = array_filter($element['plugins'], function ($e) {
    return !in_array($e, $this->incompatiblePlugins);
  }, ARRAY_FILTER_USE_KEY);
  return $element;
}