Is it possible to add a new state (and transitions) to an already existing Drupal 8 Workflows through a custom module?

And can we were to apply this to all workflows available?

Or is it possible to add new state to existing workflows through code?


I use module described as following link:- https://www.drupal.org/docs/8/core/modules/workflows/overview

I was able to add workflow element with below code, but is that correct way?

\Drupal::configFactory()->getEditable('workflows.workflow.standard')->set('type_settings.states.perform_check',array("published"=>false,"default_revision"=> false, "label"=>"Perform Check","weight"=> -3))->save();

It added "perform_check" state with below settings:-

  • published: false
  • default_revision: false
  • label: 'In Performance Check'
  • weight: -3
  • Like what for example? – leymannx Jan 16 at 3:02
  • @leymannx added more info in post. please let me know if more info needed. thanks. – mstrdruids Jan 16 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.