Closed (fixed)
Project:
Workflows Field
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
9 Sep 2017 at 14:09 UTC
Updated:
13 Oct 2017 at 09:20 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
sam152 commentedThis is a great idea, will this allow us to remove the custom widget?
Comment #3
tacituseu commentedYes it will.
Comment #4
tacituseu commentedCould at the same time get rid of the custom formatter and replace it with
'list_default'butDrupal\options\Plugin\Field\FieldFormatter\OptionsDefaultFormatterhardcoded the property name to'value', so would have to change the property name from the current'state'.Comment #5
sam152 commentedWould that work if state is the machine name and we want to show the label?
Comment #6
tacituseu commentedYes, it gets the labels via
OptionsProviderInterface::getPossibleOptions()so it turns out just fine.Comment #7
sam152 commentedOkay, I say it's probably worth updating the column name.
Comment #8
tacituseu commentedHere's an initial patch, mostly based on state_machine, so all credit to @bojanz.
Notes:
1. to preserve relative ordering of states used
WorkflowTypeInterface::getStates()and filtered it withStateInterface::canTransitionTo(), instead of usingWorkflowTypeInterface::getTransitionsForState()approach2.
WorkflowsFieldItem::getWorkflow()gets called fromWorkflowsFieldItem::applyDefaultValue()quite early (atFieldItemInterface::storageSettingsForm()stage) so changed its implementation to returnNULLwhen it is unknown, will need to look more into it to make sure::applyDefaultValue()does what I think it does ;)3. keeping current state needs explicit 'keep at' transitions (as is the case in core now)
Should work, but still needs work, will get back to it in a week or so, NR just for testing.
Comment #10
tacituseu commentedComment #12
tacituseu commentedThis should do it.
Comment #14
sam152 commentedTest fixes.
Comment #16
sam152 commentedTest fixed on commit.