You are here

function ctools_export_ui_ctools_access_set in Chaos Tool Suite (ctools) 6

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

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 783
CTools primary module file.

Code

function ctools_export_ui_ctools_access_set($argument, $access) {
  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);
    }
    $item->access = $access;
    return $handler
      ->edit_cache_set_key($item, $key);
  }
}