You are here

public function Yandex::formAttachGeocoder in Geolocation Field 8.2

Same name and namespace in other branches
  1. 8.3 modules/geolocation_yandex/src/Plugin/geolocation/Geocoder/Yandex.php \Drupal\geolocation_yandex\Plugin\geolocation\Geocoder\Yandex::formAttachGeocoder()

Attach geocoding logic to input element.

Parameters

array $render_array: Form containing the input element.

string $element_name: Name of the input element.

Return value

array|null Updated form element or NULL.

Overrides GeocoderBase::formAttachGeocoder

File

modules/geolocation_yandex/src/Plugin/geolocation/Geocoder/Yandex.php, line 29

Class

Yandex
Provides the Yandex.

Namespace

Drupal\geolocation_yandex\Plugin\geolocation\Geocoder

Code

public function formAttachGeocoder(array &$render_array, $element_name) {
  parent::formAttachGeocoder($render_array, $element_name);
  $render_array['#attached'] = BubbleableMetadata::mergeAttachments(empty($render_array['#attached']) ? [] : $render_array['#attached'], [
    'drupalSettings' => [
      'geolocation' => [
        'geocoder' => [
          $this
            ->getPluginId() => [],
        ],
      ],
    ],
  ]);
}