You are here

private function GeofieldMapFieldTrait::setMapCenterElement in Geofield Map 8

Same name and namespace in other branches
  1. 8.2 src/GeofieldMapFieldTrait.php \Drupal\geofield_map\GeofieldMapFieldTrait::setMapCenterElement()

Set Map Center Element.

Parameters

array $settings: The Form Settings.

array $elements: The Form element to alter.

1 call to GeofieldMapFieldTrait::setMapCenterElement()
GeofieldMapFieldTrait::generateGmapSettingsForm in src/GeofieldMapFieldTrait.php
Generate the Google Map Settings Form.

File

src/GeofieldMapFieldTrait.php, line 500

Class

GeofieldMapFieldTrait
Class GeofieldMapFieldTrait.

Namespace

Drupal\geofield_map

Code

private function setMapCenterElement(array $settings, array &$elements) {
  $elements['map_center'] = [
    '#type' => 'geofield_latlon',
    '#title' => $this
      ->t('Default Center'),
    '#default_value' => $settings['map_center'],
    '#size' => 25,
    '#description' => $this
      ->t('If there are no entries on the map, where should the map be centered?'),
    '#geolocation' => TRUE,
    'center_force' => [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Force the Map Center'),
      '#description' => $this
        ->t('The Map will generally focus center on the input Geofields.<br>This option will instead force the Map Center notwithstanding the Geofield Values'),
      '#default_value' => $settings['map_center']['center_force'],
      '#return_value' => 1,
    ],
  ];
}