function CachePluginBase::restore_headers

Restore out of band data saved to cache. Copied from Panels.

1 call to CachePluginBase::restore_headers()
CachePluginBase::cache_get in drupal/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php
Retrieve data from the cache.

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/cache/CachePluginBase.php, line 257
Definition of Drupal\views\Plugin\views\cache\CachePluginBase.

Class

CachePluginBase
The base plugin to handle caching.

Namespace

Drupal\views\Plugin\views\cache

Code

function restore_headers() {
  if (!empty($this->storage['head'])) {
    drupal_add_html_head($this->storage['head']);
  }
  if (!empty($this->storage['css'])) {
    foreach ($this->storage['css'] as $args) {
      $this->view->element['#attached']['css'][] = $args;
    }
  }
  if (!empty($this->storage['js'])) {
    foreach ($this->storage['js'] as $key => $args) {
      if ($key !== 'settings') {
        $this->view->element['#attached']['js'][] = $args;
      }
      else {
        foreach ($args as $setting) {
          $this->view->element['#attached']['js']['setting'][] = $setting;
        }
      }
    }
  }
}