You are here

public function FixedCoordinates::getCoordinates in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8.2 src/Plugin/geolocation/Location/FixedCoordinates.php \Drupal\geolocation\Plugin\geolocation\Location\FixedCoordinates::getCoordinates()

Get map location.

Parameters

int $location_option_id: Location option ID.

array $location_option_settings: The current feature settings.

mixed $context: Context like field formatter, field widget or view.

Return value

array With content 'lat' => latitude 'lng' => longitude

Overrides LocationBase::getCoordinates

File

src/Plugin/geolocation/Location/FixedCoordinates.php, line 60

Class

FixedCoordinates
Fixed coordinates map center.

Namespace

Drupal\geolocation\Plugin\geolocation\Location

Code

public function getCoordinates($center_option_id, array $center_option_settings, $context = NULL) {
  $settings = $this
    ->getSettings($center_option_settings);
  return [
    'lat' => (double) $settings['latitude'],
    'lng' => (double) $settings['longitude'],
  ];
}