Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
A workflow defined in a feature "A" and a workflow field defined in feature "B" using the workflow defined in "A" causes the same workflow to be redefined in feature "B", which causes a feature conflict.
Proposed resolution
?
Remaining tasks
See if this is related to #2265701: [EXPORTING] Workflow feature install re-writes SID's to match their weight and appears as overridden
Comment | File | Size | Author |
---|---|---|---|
#19 | workflow-features_export_duplicate_workflow-2375261-19.patch | 504 bytes | Chris Burge |
Comments
Comment #1
kaareComment #2
johnvIn the past, it was possible to have a feature with a workflow field, without its workflow. ATM the workflow is inserted automatically. In your use case, is it needed to have two features? IOW , is this just a helpful remark, or are gou hindered in your use case?
Comment #3
kaare@johnv: I was forced to split a huge feature into several smaller ones, and one of the solutions was to isolate the content types into separate features. So at the "bottom" feature "A" I added the workflow and assumed I could create the workflow field (base field) in a separate feature "B" and then further workflow field instances in "C", "D", etc. It works if I manually remove the duplicate workflow feature component from feature "B", "C" and "D", but it will be tedious in the long run :-)
Realizing this I think my next attempt will be to extract everything that has to do with workflow configuration into a separate feature on top of "B", "C" and "D. See, I have several features with different content types and they all have a workflow field attached. Moving the workflow and workflow fields out of these and into a standalone feature might solve this as a workaround.
Comment #4
kaareSo yeah, separating everything to do with workflows in one feature works. The base workflow, workflow field definitions and workflow field instance spread across many content types are now separated by itself as a workaround and this also separates the bug mentioned above from disturbing other features.
Comment #5
Leeteq CreditAttribution: Leeteq commented(Not confirming, just adding the referenced issue as a "related issue" so that the people "over there" are also automatically informed about this issue (and its status).)
Comment #6
sleepingmonkWe are experiencing this issue as well. We have several content types with workflow field instance on them. Each with their own feature, plus a separate workflow feature to hold base workflow configuration. We need to be able to manage each of these individually.
Each time we create or update a feature that includes the workflow field instance it includes conflicting Workflow code in each one. We have been manually removing this code each time.
Comment #8
johnvThe exporting of workflow and Workflow Field definition is now decoupled.
Comment #10
johnvThat was the wrong approach.
IMO the system works fine.
When you export a workflow_field, it add the workflow as a dependency. This is OK for simple workflows (1 field, 1 workflow). it avoids confusion for the user.
For complicated configurations, you have more complicated options.
At /admin/structure/features/create, you can creat a feature. There, you can also UNCHECK the "Workflow (n) (Workflow)" part.
I hope you can agree with that.
Comment #11
kaareI still doesn't work (as of 7.x-2.6):
Steps to reproduce:
workflowfield
andworkflow_admin_ui
.wf
with a few states inadmin/config/workflow/workflow
.a
with a new workflowfieldfield_wf
using the above workflow definitionwf
.b
with the existing workflow fieldfield_wf
setup above.content_a
and select the content typea
as the only included setting. Assuming you have Add auto-detected dependencies on, this will add the necessary additional settings: The workflow definition, the base field and the field instancea->field_wf
. Notice that the workflow definition is available in the features UI as an selectable option.content_b
and select the content typeb
as the only included setting. This will also include the field instanceb->field_wf
setting. Notice how the workflow definition is unavailable as an option here. Creating this feature still includes the workflow definition, causing a conflict with the featurecontent_a
. The hookhook_default_Workflow()
is still implemented incontent_b.features.inc
and included in the feature incontent_b.info
.This means I cannot un-select the workflow definition created in
content_a
. It's not available in the features UI as an option to un-select. I even tried removing the conflicting code incontent_b.info
andcontent_b.features.inc
, and manually adding this bit to the info file:Re-creating the feature after this still adds the workflow definition to the feature
content_b
.if the workflow definition were available as an option in the features UI, I'd agree with works as designed. It's a satisfactory solution, but it doesn't now. It's still a bug.
Comment #12
johnvComment #13
WorldFallz CreditAttribution: WorldFallz commentedI can confirm this behavior. And agree with kaare-- if we could simply configure workflow inclusion/exclusion via the standard features ui it wouldn't be an issue.
The problem is, every time i save my field bases feature, workflow silently insists on including itself (the fieldset doesn't even appear at all-- not even empty), so once it's been generated, it immediately conflicts with the config feature I use for site configuration.
So far the only way i've found to 'fix' it, is to resave the config feature unchecking the workflow there (the fieldset does show there), generate it, go to the field base feature, uncheck workflow there (it now shows), generate it again, then go back to the config feature, recheck the workflows, and finally generate the feature again. That's 4 feature generations when it should be one.
So far I haven't been able to debug why the workflow fieldset isn't showing in the conflicted feature-- fixing that would take care of the issue.
Comment #14
WorldFallz CreditAttribution: WorldFallz commentedThere's actually no patch here that 'needs work' atm.
Comment #15
WorldFallz CreditAttribution: WorldFallz commented@kaare /#4 - you mean you have a separate feature that contains the workflow definitions, the workflow field bases, and workflow field instances all together? This breaks the whole field_bases in one feature best practice, but it might be worth it until this has a fix.
Comment #16
kaare@worldfallz: Yep. That's right.
Comment #17
WorldFallz CreditAttribution: WorldFallz commentedIt seems to be working fine so far. It drives me crazy to not have all my field bases in one place, but rebuilding all those features every time something changed was driving me crazier, lol.
Thanks for the tip!
Comment #18
johnvPerhaps the committed #2484297-47: Features import / revert broken in 2.5+ contains an improvement for this issue.
Comment #19
Chris Burge CreditAttribution: Chris Burge commentedThe behavior described above is by design. See the code below
// Add dependency on workflow_field
:I don't think this behavior is consistent with Features. Field bases are exportable. Field instances are exportable. A field instance isn't tied to its field base. There's no assumption that a field base should automatically be exported with a field instance. Organic Groups doesn't do anything like this, nor does Panelizer or File Entity/Media. I can't think of another module that provides exportables that makes a similar assumption.
Attached is a patch to remove this behavior.
Comment #21
johnv#19 is committed. Thanks.