You are here

public function Base::attached in Openlayers 7.3

Returns a list of attachments for building the render array.

Return value

array The attachments to add.

Overrides ObjectInterface::attached

6 calls to Base::attached()
BootstrapjsAlert::attached in src/Plugin/Component/BootstrapjsAlert/BootstrapjsAlert.php
Returns a list of attachments for building the render array.
BootstrapjsPopup::attached in src/Plugin/Component/BootstrapjsPopup/BootstrapjsPopup.php
Returns a list of attachments for building the render array.
GeoJSON::attached in src/Plugin/Source/GeoJSON/GeoJSON.php
Returns a list of attachments for building the render array.
Map::attached in src/Types/Map.php
Returns a list of attachments for building the render array.
OL3Cesium::attached in modules/openlayers_cesium/src/Plugin/Component/OL3Cesium/OL3Cesium.php
@inheritDoc

... See full list

6 methods override Base::attached()
BootstrapjsAlert::attached in src/Plugin/Component/BootstrapjsAlert/BootstrapjsAlert.php
Returns a list of attachments for building the render array.
BootstrapjsPopup::attached in src/Plugin/Component/BootstrapjsPopup/BootstrapjsPopup.php
Returns a list of attachments for building the render array.
GeoJSON::attached in src/Plugin/Source/GeoJSON/GeoJSON.php
Returns a list of attachments for building the render array.
Map::attached in src/Types/Map.php
Returns a list of attachments for building the render array.
OL3Cesium::attached in modules/openlayers_cesium/src/Plugin/Component/OL3Cesium/OL3Cesium.php
@inheritDoc

... See full list

File

src/Types/Base.php, line 401
Class Object.

Class

Base
Class Base.

Namespace

Drupal\openlayers\Types

Code

public function attached() {
  if ($plugin = $this
    ->getPluginDefinition()) {
    $path = $this
      ->getClassDirectory();
    $jsdir = $path . '/js';
    $cssdir = $path . '/css';
    if (file_exists($jsdir)) {
      foreach (file_scan_directory($jsdir, '/.*\\.js$/') as $file) {
        $this->attached['js'][$file->uri] = array(
          'data' => $file->uri,
          'type' => 'file',
          'group' => Config::get('openlayers.js_css.group'),
          'weight' => Config::get('openlayers.js_css.weight'),
        );
      }
    }
    if (file_exists($cssdir)) {
      foreach (file_scan_directory($cssdir, '/.*\\.css$/') as $file) {
        $this->attached['css'][$file->uri] = array(
          'data' => $file->uri,
          'type' => 'file',
          'group' => Config::get('openlayers.js_css.group'),
          'weight' => Config::get('openlayers.js_css.weight'),
          'media' => Config::get('openlayers.js_css.media'),
        );
      }
    }
  }
  return $this->attached;
}