You are here

private function GeofieldMapFieldTrait::setMapAdditionalOptionsElement in Geofield Map 8

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

Set Map Additional Options Element.

Parameters

array $settings: The Form Settings.

array $elements: The Form element to alter.

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

File

src/GeofieldMapFieldTrait.php, line 878

Class

GeofieldMapFieldTrait
Class GeofieldMapFieldTrait.

Namespace

Drupal\geofield_map

Code

private function setMapAdditionalOptionsElement(array $settings, array &$elements) {
  $elements['map_additional_options'] = [
    '#type' => 'textarea',
    '#rows' => 5,
    '#title' => $this
      ->t('Map Additional Options'),
    '#description' => $this
      ->t('<strong>These will override the above settings</strong><br>An object literal of additional map options, that comply with the Google Maps JavaScript API.<br>The syntax should respect the javascript object notation (json) format.<br>As suggested in the field placeholder, always use double quotes (") both for the indexes and the string values.<br>It is even possible to input Map Control Positions. For this use the numeric values of the google.maps.ControlPosition, otherwise the option will be passed as incomprehensible string to Google Maps API.'),
    '#default_value' => $settings['map_additional_options'],
    '#placeholder' => '{"disableDoubleClickZoom": "cooperative",
"gestureHandling": "none",
"streetViewControlOptions": {"position": 5}
}',
    '#element_validate' => [
      [
        get_class($this),
        'jsonValidate',
      ],
    ],
  ];
}