You are here

public function Map::attached in Openlayers 7.3

Returns a list of attachments for building the render array.

Return value

array The attachments to add.

Overrides Base::attached

1 call to Map::attached()
OLMap::attached in src/Plugin/Map/OLMap/OLMap.php
Returns a list of attachments for building the render array.
1 method overrides Map::attached()
OLMap::attached in src/Plugin/Map/OLMap/OLMap.php
Returns a list of attachments for building the render array.

File

src/Types/Map.php, line 98
Class Map.

Class

Map
Class Map.

Namespace

Drupal\openlayers\Types

Code

public function attached() {
  $attached = parent::attached();
  $settings = $this
    ->getCollection()
    ->getJS();
  $settings['map'] = array_shift($settings['map']);
  $attached['js'][] = array(
    'data' => array(
      'openlayers' => array(
        'maps' => array(
          $this
            ->getId() => $settings,
        ),
      ),
    ),
    'type' => 'setting',
  );
  return $attached;
}