You are here

public static function Openlayers::getAttached in Openlayers 7.3

Returns the list of attached libraries or js/css files.

Return value

array Array containing the attachment libraries to load.

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

File

src/Openlayers.php, line 403
Contains Openlayers.

Class

Openlayers
Class Openlayers.

Namespace

Drupal\openlayers

Code

public static function getAttached() {
  $attached = array();
  if (!self::detectLibrary()) {
    $configuration = array(
      'errorMessage' => t('Unable to load the Openlayers JS library variant, please <a href="@openlayers_admin">update your settings</a> and select a valid variant of the library.', array(
        '@openlayers_admin' => '/admin/structure/openlayers',
      )),
    );
    \Drupal::service('openlayers.Types')
      ->createInstance('Error', $configuration)
      ->init();
    return $attached;
  }
  $attached['libraries_load'] = array(
    'openlayers3' => array(
      'openlayers3',
      Config::get('openlayers.variant', NULL),
    ),
  );
  if (Config::get('openlayers.debug', FALSE)) {
    $attached['libraries_load']['openlayers3_integration'] = array(
      'openlayers3_integration',
      'debug',
    );
  }
  return $attached;
}