You are here

function panels_content_cache_save in Panels Content Cache 7

Same name and namespace in other branches
  1. 6 panels_content_cache.module \panels_content_cache_save()

Helper function to save items into the panels_content_cache table.

Parameters

array $content_cache: An array of panels display or pane objects to save to panels_content_cache table.

1 call to panels_content_cache_save()
panels_content_cache_panels_display_save in ./panels_content_cache.module
Implements hook_panels_display_save().

File

./panels_content_cache.module, line 170
Primary hook implementations.

Code

function panels_content_cache_save($content_cache = array()) {
  if (!empty($content_cache)) {
    foreach ($content_cache as $display) {
      if (!empty($display->cache['settings']['content_types'])) {
        $types = array_filter($display->cache['settings']['content_types']);
        foreach ($types as $type) {
          $row = new stdClass();
          $row->did = $display->did;
          $row->type = $type;
          $row->pid = isset($display->pid) ? $display->pid : NULL;
          drupal_write_record('panels_content_cache', $row);
        }
      }
    }
  }
}