public function CachePluginBase::restoreHeaders

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

1 call to CachePluginBase::restoreHeaders()
CachePluginBase::cacheGet 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 242
Definition of Drupal\views\Plugin\views\cache\CachePluginBase.

Class

CachePluginBase
The base plugin to handle caching.

Namespace

Drupal\views\Plugin\views\cache

Code

public function restoreHeaders() {
  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;
        }
      }
    }
  }
}