You are here

protected function WorkflowFeaturesController::export_render_workflow in Workflow 7.2

Renders the provided workflow into export code.

Parameters

Workflow $workflow: The workflow to export.

string $identifier: The unique machine name for the workflow in the export.

array $code: A reference to the export code array that will receive the output.

1 call to WorkflowFeaturesController::export_render_workflow()
WorkflowFeaturesController::export_render in ./workflow.features.inc
Generates the result for hook_features_export_render().

File

./workflow.features.inc, line 76
Provides Features integration for Workflow using the CRUD API.

Class

WorkflowFeaturesController
Default controller handling features integration.

Code

protected function export_render_workflow(Workflow $workflow, $identifier, array &$code) {

  // Make sure data is not copied to the database.
  $workflow = clone $workflow;
  $this
    ->sanitize_workflow_for_export($workflow);

  // Make sure to escape the characters \ and '.
  // The following method has the advantage, that you can export with
  // features,
  // and later import without enabling Features in the target system.
  $workflow_export = addcslashes(entity_export($this->type, $workflow, '  '), '\\\'');
  $workflow_identifier = features_var_export($identifier);
  $code[] = "  // Exported workflow: {$workflow_identifier}";
  $code[] = "  \$workflows[{$workflow_identifier}] = entity_import('{$this->type}', '" . $workflow_export . "');";
  $code[] = '';

  // Blank line
}