You are here

function panelizer_ctools_access_get in Panelizer 7.2

Same name and namespace in other branches
  1. 7.3 panelizer.module \panelizer_ctools_access_get()

Implement CTools access form caching callback: get.

File

./panelizer.module, line 262
The Panelizer module attaches panels to entities, providing default panels and allowing each panel to be configured independently by privileged users.

Code

function panelizer_ctools_access_get($argument) {
  list($entity_type, $bundle, $name) = explode(':', $argument);
  $handler = panelizer_entity_plugin_get_handler($entity_type);
  $panelizer = $handler
    ->get_default_panelizer_object($bundle, $name);
  if (empty($panelizer)) {
    return;
  }
  if (!$handler
    ->access_default_panelizer_object($panelizer)) {
    return;
  }

  // First, see if there's a cache
  ctools_include('object-cache');
  $access = ctools_object_cache_get('panelizer_access', $argument);
  if (!$access) {
    $access = $panelizer->access;
  }
  $context = $handler
    ->get_contexts($panelizer);
  return array(
    $access,
    $context,
  );
}