function workflow_access_features_export in Workflow 7.2
Same name and namespace in other branches
- 7 workflow_access/workflow_access.features.inc \workflow_access_features_export()
Implements hook_features_export().
File
- workflow_access/
workflow_access.features.inc, line 52 - Workflow_access records are a **faux-exportable** component.
Code
function workflow_access_features_export($data, &$export, $module_name = '') {
$pipe = array();
$export['dependencies']['workflow_access'] = 'workflow_access';
$export['dependencies']['workflow'] = 'workflow';
$roles = _workflow_access_get_affected_roles();
foreach ($data as $workflow_name) {
if ($workflow = workflow_load_by_name($workflow_name)) {
$export['features']['workflow_access'][$workflow_name] = $workflow_name;
$export['features']['workflow'][$workflow_name] = $workflow_name;
// Access configuration for a workflow needs that workflow to exist.
$pipe['workflow'][$workflow_name] = $workflow_name;
// And it needs the roles to which rights are granted.
if (isset($roles[$workflow_name])) {
foreach ($roles[$workflow_name] as $role_name) {
$pipe['user_role'][$role_name] = $role_name;
}
}
}
}
return $pipe;
}