diff --git a/workflow.rst b/workflow.rst index 5624f0785a0..7f9bd2cbe5a 100644 --- a/workflow.rst +++ b/workflow.rst @@ -692,18 +692,32 @@ Then you can access this metadata in your controller as follows:: ->getWorkflowMetadata()['title'] ?? 'Default title' ; + // or + $maxNumOfWords = $workflow + ->getMetadataStore() + ->getPlaceMetadata('draft')['max_num_of_words'] ?? 500 + ; + // or $aTransition = $workflow->getDefinition()->getTransitions()[0]; - $transitionTitle = $workflow + $priority = $workflow ->getMetadataStore() ->getTransitionMetadata($aTransition)['priority'] ?? 0 ; } -There is a shortcut that works with every metadata level:: +There is a shortcut that works with every metadata level. With this shortcut: + +* Use null to get workflow metadata +* Use a string (the place name) to get place metadata +* Use a Transition instance to get transition metadata + +Example:: + + $title = $workflow->getMetadataStore()->getMetadata()['title']; + $maxNumOfWords = $workflow->getMetadataStore()->getMetadata('draft')['max_num_of_words']; + $priority = $workflow->getMetadataStore()->getMetadata($aTransition)['priority']; - $title = $workflow->getMetadataStore()->getMetadata('title'); - $priority = $workflow->getMetadataStore()->getMetadata('priority'); In a :ref:`flash message ` in your controller::