You are here

function _openlayers_services_retrieve in Openlayers 7.3

@file Helper functions

1 string reference to '_openlayers_services_retrieve'
openlayers_services_services_resources in modules/openlayers_services/openlayers_services.module
Implements hook_services_resources().

File

modules/openlayers_services/openlayers_services.helpers.inc, line 7
Helper functions

Code

function _openlayers_services_retrieve($name) {

  /** @var \Drupal\openlayers\Types\MapInterface $map */
  if (($map = \Drupal\openlayers\Openlayers::load('Map', $name)) == TRUE) {
    array_map('drupal_static_reset', array(
      'drupal_add_css',
      'drupal_add_js',
      'libraries_load',
      'drupal_add_library',
    ));
    drupal_process_attached(array(
      '#attached' => $map
        ->getCollection()
        ->getAttached(),
    ));
    drupal_add_css(drupal_get_path('module', 'openlayers_services') . '/css/reset.css');
    return theme('openlayers_map_iframe', array(
      'page' => $map
        ->render(),
      'scripts' => drupal_get_js(),
      'styles' => drupal_get_css(),
    ));
  }
}