You are here

public function GeofieldField::getSettingsForm in Geocoder 8.3

Same name and namespace in other branches
  1. 8.2 modules/geocoder_geofield/src/Plugin/Geocoder/Field/GeofieldField.php \Drupal\geocoder_geofield\Plugin\Geocoder\Field\GeofieldField::getSettingsForm()

Provides the third party field settings subform.

The returned form API element will be added in behalf of 'geocoder_field' module as third party settings to the field that is storing the geocoding result.

Parameters

\Drupal\Core\Field\FieldConfigInterface $field: The field config.

array $form: The form API form array.

\Drupal\Core\Form\FormStateInterface $form_state: The form state object.

Return value

array A form API form.

Overrides DefaultField::getSettingsForm

File

modules/geocoder_geofield/src/Plugin/Geocoder/Field/GeofieldField.php, line 25

Class

GeofieldField
Provides a geofield geocoder field plugin.

Namespace

Drupal\geocoder_geofield\Plugin\Geocoder\Field

Code

public function getSettingsForm(FieldConfigInterface $field, array $form, FormStateInterface &$form_state) {
  $element = parent::getSettingsForm($field, $form, $form_state);

  // The Geofield can just be object of Geocoding.
  $element['method']['#options'] = [
    'none' => $this
      ->t('No geocoding'),
    'geocode' => $this
      ->t('<b>Geocode</b> from an existing field'),
  ];

  // On Geofield the dumper should always be 'wkt'.
  $element['dumper'] = [
    '#type' => 'value',
    '#value' => 'wkt',
  ];
  return $element;
}