I'm using features to import two custom content types, some custom fields, views, a single workflow, and the permissions associated with them. Everything imports wonderfully except the workflow. The workflow module is one and configured as proper, but the workflow I've set to be imported with everything doesn't make the trip for some reason.

Comments

hefox’s picture

Project: Features » Workflow
Version: 7.x-1.0-rc2 » 7.x-1.x-dev

Please provide as much information as possible, including the feature at issue if possible, etc.

Vidus’s picture

Alright, let me know what else you need to see. Here is the text of the features.inc file:

<?php
/**
 * @file
 * open_pw_drafting.features.inc
 */

/**
 * Implements hook_views_api().
 */
function open_pw_drafting_views_api() {
  return array("version" => "3.0");
}

/**
 * Implements hook_node_info().
 */
function open_pw_drafting_node_info() {
  $items = array(
    'draft' => array(
      'name' => t('Draft'),
      'base' => 'node_content',
      'description' => t('Use drafts to complete and submit solo projects.'),
      'has_title' => '1',
      'title_label' => t('Title'),
      'help' => t('<h1>Drafting</h1>
When creating a draft, make sure to give your content a title, body text, and add any attachments you\'d like to include.  When you\'ve done that, you should then choose where in your workflow the draft should go: drafting, review requested, or submitted.  Only drafts set to submitted can be graded by your instructor.'),
    ),
    'instructor_content' => array(
      'name' => t('Instructor Content'),
      'base' => 'node_content',
      'description' => t('Use instructor content to create and post assignments and other types of content for students.'),
      'has_title' => '1',
      'title_label' => t('Title'),
      'help' => t('<h1>Instructor Content</h1>
Instructor Content can be any content you\'d like to share with students that has a date and project associated with it.  This can be assignments, files, readings, etc.  It is recommended that assignments are associated with their due date.'),
    ),
  );
  return $items;
}

/**
 * Implements hook_workflow_features_default_workflow().
 */
function open_pw_drafting_workflow_features_default_workflow() {
  return array(
    'Drafting Workflow' => array(
      'name' => 'Drafting Workflow',
      'tab_roles' => 'author,3',
      'options' => 'a:3:{s:16:"comment_log_node";i:0;s:15:"comment_log_tab";i:0;s:13:"name_as_title";i:1;}',
      'states' => array(
        0 => array(
          'state' => '(creation)',
          'weight' => '-50',
          'sysid' => '1',
          'status' => '1',
        ),
        1 => array(
          'state' => 'Drafting',
          'weight' => '-10',
          'sysid' => '0',
          'status' => '1',
        ),
        2 => array(
          'state' => 'Review Requested',
          'weight' => '-9',
          'sysid' => '0',
          'status' => '1',
        ),
        3 => array(
          'state' => 'Submitted',
          'weight' => '0',
          'sysid' => '0',
          'status' => '1',
        ),
      ),
      'transitions' => array(
        0 => array(
          'sid' => '(creation)',
          'target_sid' => 'Drafting',
          'roles' => 'author,3',
        ),
        1 => array(
          'sid' => '(creation)',
          'target_sid' => 'Review Requested',
          'roles' => 'author,3',
        ),
        2 => array(
          'sid' => '(creation)',
          'target_sid' => 'Submitted',
          'roles' => 'author,3',
        ),
        3 => array(
          'sid' => 'Drafting',
          'target_sid' => 'Review Requested',
          'roles' => 'author,3',
        ),
        4 => array(
          'sid' => 'Drafting',
          'target_sid' => 'Submitted',
          'roles' => 'author,3',
        ),
        5 => array(
          'sid' => 'Review Requested',
          'target_sid' => 'Drafting',
          'roles' => 'author,3',
        ),
        6 => array(
          'sid' => 'Review Requested',
          'target_sid' => 'Submitted',
          'roles' => 'author,3',
        ),
        7 => array(
          'sid' => 'Submitted',
          'target_sid' => 'Drafting',
          'roles' => 'author,3',
        ),
        8 => array(
          'sid' => 'Submitted',
          'target_sid' => 'Review Requested',
          'roles' => 'author,3',
        ),
      ),
      'node_types' => array(
        0 => array(
          'type' => 'draft',
          'wid' => '1',
        ),
        1 => array(
          'type' => 'group_draft',
          'wid' => '1',
        ),
      ),
    ),
  );
}
kenorb’s picture

I've similar problem.

File: aat_wex_feature.features.inc
Code:


/**
 * Implements hook_workflow_features_default_workflow().
 */
function aat_wex_feature_workflow_features_default_workflow() {
  return array(
    'WEX' => array(
      'name' => 'WEX',
      'tab_roles' => '',
      'options' => 'a:3:{s:16:"comment_log_node";i:0;s:15:"comment_log_tab";i:0;s:13:"name_as_title";i:0;}',
      'states' => array(
        0 => array(
          'state' => '(creation)',
          'weight' => '-50',
          'sysid' => '1',
          'status' => '1',
        ),
        1 => array(
          'state' => 'Approved|Approve',
          'weight' => '0',
          'sysid' => '0',
          'status' => '1',
        ),
...

        ),
      ),
    ),
  );
}

The function is executed properly.
In feature status it says: 'Default'.
Module workflow_views is enabled properly.
But in the configuration I've got: "No workflows have been added.".
I've version = "7.x-1.0" of Workflow module.

I'm not sure, but probably forced feature revert helps (drush -yv --force fr my_feature).

kenorb’s picture

I think it's not creating the Workflows when module feature is being enabled, but it's recreating workflow states when the feature is reverted.

cloudbull’s picture

same issue here ~

jpoesen’s picture

Confirming the problem and the workaround.

After enabling a Feature with a workflow component, its state is overridden.
Doing a drush fr <featurename> brings its state to default and properly creates the workflow states.

Any subsequent workflow changes are properly added to the feature using drush fu <featurename> and they are properly propagated with drush fr <featurename> - the standard way to deploy Feature changes.

So the problem is really only an issue on the initial enabling of the module. Once a feature-revert has been performed, the feature/workflow behaves normally.

EDIT: more info this duplicate issue: #1589254: Workflows not imported with Features

kenorb’s picture

Which duplicate issue? It's pointing to the current issue.

adamtong’s picture

I have same problem. how to fix it? any patch?

adamtong’s picture

Category: bug » feature

i found the lastest dev version still cannot import the workflow properly by Features.

will it be implemented as a new features?

duaelfr’s picture

Category: feature » bug
Status: Active » Needs review
StatusFileSize
new615 bytes

Here is a fix for the features integration of workflow.

This patch is part of the #1day1patch initiative.

nancydru’s picture

Status: Needs review » Fixed

Committed with attribution. Thanks for the patch.

Status: Fixed » Closed (fixed)

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

fedia.io1’s picture

Version: 7.x-1.x-dev » 7.x-1.2
Status: Closed (fixed) » Needs review
StatusFileSize
new405 bytes

I got the same problem (workflows aren't created) during installation of a custom drupal-distribution (custom install-profile) or setting up custom drupal web test case.
I am using 'Workflow' module (7.x-1.2) and 'Features' (7.x-2.0).
Cause of this problem is that during installation (or test-run) features aren't reverting but they are rebuilding.
Here is patch which is fixing this.

johnv’s picture

Title: Workflows Not Imported » Workflows not imported with Features
johnv’s picture

Component: Code » Features
Issue summary: View changes
colan’s picture

Status: Needs review » Closed (fixed)

Closing again as #13 is the same patch as #10 which was already committed in 8f78eb017d.

johnv’s picture

Status: Closed (fixed) » Needs review

@colan, are you sure? #13 implements hook_features_rebuild(), which is not in #10.

colan’s picture

@johnv: Wow, you're right. Looks like there's a problem with the Dreditor I have installed in Chrome. When I click on the "Review" button next to each patch, I get the same results, but when I click on the actual patch files, they're different.

Sorry about that!

Edit: The Dreditor issue is REVIEW button does not open linked patch but previously hidden patch in case anyone else runs into this.

johnv’s picture

Seems like DrEditor needs a D7 upgrade, too :-)

johnv’s picture

Status: Needs review » Fixed

@fedia.io1, please open a new issue the next time. I've committed your patch - it was proposed in other issues, too. It seems the hook is renamed in D6->D7. See this commit.

Status: Fixed » Closed (fixed)

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