protected function WorkflowFeaturesController::sanitize_workflow_for_export in Workflow 7.2
Prepares the provided workflow for export.
Removes serial IDs and replaces them with machine names.
Parameters
Workflow $workflow: The workflow to sanitize. The contents of this object are modified directly.
1 call to WorkflowFeaturesController::sanitize_workflow_for_export()
- WorkflowFeaturesController::export_render_workflow in ./
workflow.features.inc - Renders the provided workflow into export code.
File
- ./
workflow.features.inc, line 102 - Provides Features integration for Workflow using the CRUD API.
Class
- WorkflowFeaturesController
- Default controller handling features integration.
Code
protected function sanitize_workflow_for_export(Workflow $workflow) {
// Eliminate serial IDs in exports to prevent "Overridden" status.
// We use machine names instead.
unset($workflow->wid);
// Add roles to translate role IDs on target system.
$permission = NULL;
// Get system roles.
$workflow->system_roles = workflow_get_roles($permission);
// Only export system roles for roles used by this workflow.
$roles = array();
foreach ($workflow->transitions as $id => $transition) {
foreach ($transition->roles as $rid) {
$roles[] = $rid;
}
}
$roles = array_unique($roles);
foreach ($workflow->system_roles as $id => $system_role) {
if (!in_array($id, $roles)) {
unset($workflow->system_roles[$id]);
}
}
$sid_to_name_map = $this
->pack_states($workflow);
$this
->pack_transitions($workflow, $sid_to_name_map);
}