Needs work
Project:
State Machine
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 Jan 2012 at 21:07 UTC
Updated:
27 Oct 2014 at 20:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
stevectorHere's a start on this work. I'll post two patches, one against 7.x-2.x and one against #1412742: Refactor State Flow to be entity type agnostic (Rename state_flow to state_flow_node).
There are still plenty of open questions here like:
What should this entity type be called?
-I'm currently going with state_flow_history_entity. Perhaps it's overly verbose. For now it makes testing a little easier.
What role should bundles play?
-I could see bundles (and therefore fields) changing based on the workflow being used. So the workflow used by Article nodes might need a bunch of fields on it's state flow history entity. These fields could track the next relevant user with a user ref field and checkboxes for whether the Article has been cleared by the Legal and Marketing departments. Blog nodes might only need the Log textarea that is already in State Flow 7.x-1.x. So the node type would determine which workflow is used and the workflow determines which state_flow_history_entity bundle is needed. I think this approach would work fine with what I'm doing in http://drupal.org/sandbox/stevector/1405838
Comment #2
stevectorAnd here's a patch that just shows the changes since #1412742: Refactor State Flow to be entity type agnostic (Rename state_flow to state_flow_node)
Comment #3
stevectorI'm attaching a sample feature that this patch makes possible. It attaches a user ref field to the state_flow_history_entity. It also provides a rule that sends an email to the user referenced in the field when the state change occurs.
Comment #4
stevectorComment #5
yeha commentedHi Steve,
I'm reviewing the code now, but I have a question about the following:
Does it also means that multiple node types can use the same workflow but each of the node type can have different state_flow_history_entity bundle as required?
Comment #6
stevectoryeha,
Thanks for reviewing! Currently in that patch there state_flow_history_entity has only one bundle. I think it is an open question how the bundle would vary if there were than one.
In the scenario I describe in #1, state_flow_history_entity bundles would vary on the same conditions as the workflow so if two node types used the same workflow, they would also use the same state_flow_history_entity bundle.
Since none of that code is written, it could work on a different model. Perhaps bundle should be selected completely independent of workflow.
Comment #7
yeha commentedI've been working with the 7.x-1.x for awhile to extend it for my needs but it's getting to a point that I'm rewriting a lot of the state_flow module instead of just "massaging" it.
From what I understood, the selection of which workflow to use will be determined by the properties/fields on the node (entity in the future?). Within the node, there's lots of choices, node type is the logical choice but it's not limited to that. One can basically use anything from node to make the decision.
With that said, the state_flow_history_entity bundle should work the same way. Given the node (entity) or workflow (state machine object?), one can use it to determine which bundle to use.
I hope I am somewhat making sense :)
Comment #8
stevectorYes yeha, #7 makes sense.
I would add that the workflow could also also vary based on the values in the state_flow_history_entity itself. A commonly requested use case is "approval checkboxes." An organization may need a blog post to be "marketing approved," and "508 compliant." Those could be checkbox fields on the state_flow_history_entity and the workflow/events/states could prevent the a node from moving to a state like Published until all those boxes are checked.
It would be problematic if the workflow looked for a certain checkbox field but the state_flow_history_entity bundle in use didn't have that field. Of course the UI could give warning messages to protect against that situation and site-builders will always figure out ways to shoot themselves in the foot.
Comment #9
fmitchell commentedMoving this request to 7.x-3.x branch
Comment #11
stevectorState change records as entities is in 3.x. There is currently no bundle support. Switching back to active.
Comment #12
elijah lynnSetting to needs work as that seems more accurate.
Comment #13
elijah lynn