You are here

function _esi_panels__get_taskname in ESI: Edge Side Includes 7.3

Reverse the $display->cache_key encoding to get the task name.

Parameters

string $cache_key: The cache key used on a display.

Return value

string The task name of the task handler.

1 call to _esi_panels__get_taskname()
esi_panels_url in modules/esi_panels/esi_panels.module
Build the URL to use for this ESI component.

File

modules/esi_panels/esi_panels.module, line 397
ESI handler for panel panes.

Code

function _esi_panels__get_taskname($cache_key) {

  // $display->cache_key = 'panel_context:' . $task_name . ':' . $handler->name;
  // $display->cache_key = 'panelizer:' . $entity_type . ':' . $entity_id . ':' . $view_mode . ':' . $pane_id;
  if (preg_match('/^(panel_context|panelizer):([^:]+):.*$/', $cache_key, $matches)) {

    // Define task names for Panelizer panes.
    if ($matches[1] == 'panelizer') {
      switch ($matches[2]) {
        case 'node':
          return 'node_view';
        case 'taxonomy_term':
          return 'term_view';
        case 'user':
          return 'user_view';
        case 'comment':
          return 'comment_view';
        default:
          return $matches[2];
      }
    }
    else {
      return $matches[2];
    }
  }
  else {
    return FALSE;
  }
}