You are here

private function GeofieldMapFieldTrait::setGeometriesAdditionalOptionsElement in Geofield Map 8.2

Set Map Geometries Options Element.

Parameters

array $settings: The Form Settings.

array $elements: The Form element to alter.

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

File

src/GeofieldMapFieldTrait.php, line 1123

Class

GeofieldMapFieldTrait
Class GeofieldMapFieldTrait.

Namespace

Drupal\geofield_map

Code

private function setGeometriesAdditionalOptionsElement(array $settings, array &$elements) {
  $token_replacement_disclaimer = $this
    ->t('<b>Note: </b> Using <strong>Replacement Patterns</strong> it is possible to dynamically define the Path geometries options, based on the entity properties or fields values.');
  $elements['map_geometries_options'] = [
    '#type' => 'textarea',
    '#rows' => 5,
    '#title' => $this
      ->t('Map Geometries Options'),
    '#description' => $this
      ->t('Set here options that will be applied to the rendering of Map Geometries (Lines & Polylines, Polygons, Multipolygons, etc.).<br>Refer to the @polygons_documentation.<br>@token_replacement_disclaimer', [
      '@polygons_documentation' => $this->link
        ->generate($this
        ->t('Google Maps Polygons Documentation'), Url::fromUri('https://developers.google.com/maps/documentation/javascript/reference/polygon#PolylineOptions', [
        'absolute' => TRUE,
        'attributes' => [
          'target' => 'blank',
        ],
      ])),
      '@token_replacement_disclaimer' => $token_replacement_disclaimer,
    ]),
    '#default_value' => $settings['map_geometries_options'],
    '#placeholder' => self::getDefaultSettings()['map_geometries_options'],
    '#element_validate' => [
      [
        get_class($this),
        'jsonValidate',
      ],
    ],
  ];
}