You are here

function _cache_actions_load_panes in Cache Actions 6.2

Same name and namespace in other branches
  1. 7.2 cache_actions.rules.inc \_cache_actions_load_panes()
  2. 7 cache_actions.rules.inc \_cache_actions_load_panes()
1 call to _cache_actions_load_panes()
_cache_actions_get_panels_handlers in ./cache_actions.rules.inc
Get all existing handlers from page manager. This is the ugliest function in the whole module =)

File

./cache_actions.rules.inc, line 251
This file provides the rules integration for this module.

Code

function _cache_actions_load_panes($handler, $handler_title, $js = FALSE) {
  ctools_include('plugins', 'panels');
  $available_panes = array();
  $js_panes = array();
  if (isset($handler->conf['did'])) {
    $display = panels_load_display($handler->conf['did']);
  }
  else {
    $display = $handler->conf['display'];
  }
  if (isset($display->content)) {
    foreach ($display->content as $pane) {
      if ($pane->cache['method'] == 'rules') {

        // We can't satisfy a context here, so we only get the title if no context is set.
        if (empty($pane->configuration['context'])) {
          $pane_title = panels_get_pane_title($pane);
        }
        else {
          $pane_title = $pane->subtype;
        }
        $available_panes[$handler_title][$pane->pid] = $pane_title;
        $js_panes[$handler->name . ':' . $handler->task . (!empty($handler->subtask) ? ':' . $handler->subtask : '')][$pane->pid] = $pane_title;
      }
    }
  }
  if ($js) {
    return array(
      $available_panes,
      $js_panes,
    );
  }
  return $available_panes;
}