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

johnv’s picture

Version: 7.x-2.x-dev » 7.x-2.0-beta11
Status: Active » Fixed

Thanks 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.

kaare’s picture

Thanks for the quick fix!

johnv’s picture

Good to know.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.