You are here

function ctools_export_ui_ctools_access_get in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 ctools.module \ctools_export_ui_ctools_access_get()

Callback for access control ajax form on behalf of export ui.

Returns the cached access config and contexts used. Note that this is assuming that access will be in $item->access -- if it is not, an export UI plugin will have to make its own callbacks.

File

./ctools.module, line 757
CTools primary module file.

Code

function ctools_export_ui_ctools_access_get($argument) {
  ctools_include('export-ui');
  list($plugin_name, $key) = explode(':', $argument);
  $plugin = ctools_get_export_ui($plugin_name);
  $handler = ctools_export_ui_get_handler($plugin);
  if ($handler) {
    ctools_include('context');
    $item = $handler
      ->edit_cache_get($key);
    if (!$item) {
      $item = ctools_export_crud_load($handler->plugin['schema'], $key);
    }
    $contexts = ctools_context_load_contexts($item);
    return array(
      $item->access,
      $contexts,
    );
  }
}