Problem/Motivation
From workflow_features_export_render() in workflow.features.inc:
$workflow_export = features_var_export($workflow, ' ');
where $workflow now being an extension of Entity causes method_exists($var, 'export') in modules/features/features.export.inc:654 to run EntityAPIController::export():
public function export($entity, $prefix = '') {
$vars = get_object_vars($entity);
unset($vars['is_new']);
return entity_var_json_export($vars, $prefix);
}
which in turn returns exported PHP code as JSON. My exported workflow "Application state" in FEATURE.features.inc looks like this:
function FEATURE_workflow_default_workflows() {
$workflows = array();
// Exported workflow: Application state
$workflows['Application state'] = {
"name" : "Application state",
"tab_roles" : "",
"options" : [],
"states" : []
};
return $workflows;
}
Which causes a massive parse error, of course.
This is run on a completely clean install using the 'minimal' installation profile. Only workflowfield.module (not workflownode.module) and features.module were enabled in addition to their dependencies.
Proposed resolution
EntityAPIController::export() probably have to be overridden in class WorkflowController to get proper exported PHP valid content.
Remaining tasks
Implement WorkflowController:export()
Comments
Comment #1
johnvThanks for your detailed report.
export() is not overridden when an array is passed.
There is another issue with a request for a true exportable entity.
So I fixed it with the patch committed here.
Comment #2
kaareThanks for the quick fix!
Comment #3
johnvGood to know.