function workbench_workflows_exportable_access in Workbench Moderation 7.2
Determines if access an entity has access to a state/event/workflow
Parameters
$entity: A Drupal entity. Currently only nodes are supported.
$exportable: The machine name of an exportable or the loaded object.
$exportable_type: Allowed values are 'states', 'events', and 'workflows'
2 calls to workbench_workflows_exportable_access()
- workbench_workflows_guard in modules/
workbench_workflows/ workbench_workflows.module - Guard callback for the workbenchStates publish and unpublish events.
- workbench_workflows_select_workflow in modules/
workbench_workflows/ workbench_workflows.state_flow_entity.inc - Return the appropriate workflow for a node.
File
- modules/
workbench_workflows/ workbench_workflows.module, line 67 - workbench_workflows.module
Code
function workbench_workflows_exportable_access($entity, $exportable, $exportable_type = 'states') {
$contexts = array();
// The exportable might already be the loaded object.
if (is_string($exportable)) {
ctools_include('export');
$exportable = workbench_workflows_load($exportable_type, $exportable);
}
// Create a CTools context.
if (!empty($exportable->requiredcontexts[0]['name'])) {
ctools_include('context');
$contexts[] = ctools_context_create($exportable->requiredcontexts[0]['name'], $entity);
}
// Load all the contexts.
// @todo, we may need a user context other than "currently logged-in user."
$contexts = ctools_context_match_required_contexts($exportable->requiredcontexts, $contexts);
$contexts = ctools_context_load_contexts($exportable, FALSE, $contexts);
return ctools_access($exportable->access, $contexts);
}