From e91fce524e32e0251f1fe29fe773273482ba1a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 24 Sep 2024 14:17:35 +0200 Subject: [PATCH] Append workflow name in twig calls to workflow_metadata Ensuring that the twig template works if there are more than one workflow available --- .../Resources/views/Workflow/_decision.html.twig | 2 +- .../views/Workflow/_extension_list_workflow_for.html.twig | 7 ++----- .../Resources/views/Workflow/_history.html.twig | 6 +++--- .../Resources/views/Workflow/macro_breadcrumb.html.twig | 4 ++-- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig index ac85525a6..4f43c4dad 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_decision.html.twig @@ -6,7 +6,7 @@ {{ form_errors(transition_form) }} {% set step = entity_workflow.currentStepChained %} - {% set labels = workflow_metadata(entity_workflow, 'label', step.currentStep) %} + {% set labels = workflow_metadata(entity_workflow, 'label', step.currentStep, entity_workflow.workflowName) %} {% set label = labels is null ? step.currentStep : labels|localize_translatable_string %}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_extension_list_workflow_for.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_extension_list_workflow_for.html.twig index cfe8b83f5..f6d49f7d6 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/_extension_list_workflow_for.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/_extension_list_workflow_for.html.twig @@ -1,8 +1,5 @@ -{% set acl = "0" %} -{% if is_granted('CHILL_MAIN_WORKFLOW_CREATE', blank_workflow) %} - {% set acl = "1" %} -{% endif %} - +{% set acl = "1" %} +{# note: the list of available workflows already check that it is possible to create a given workflow #} {# vue component #}
{% for step in entity_workflow.stepsChained %} - {% set place_labels = workflow_metadata(entity_workflow, 'label', step.currentStep) %} + {% set place_labels = workflow_metadata(entity_workflow, 'label', step.currentStep, entity_workflow.workflowName) %} {% set place_label = place_labels is null ? step.currentStep : place_labels|localize_translatable_string %}
@@ -35,9 +35,9 @@
{% if step.next is not null %} {% set transition = chill_workflow_transition_by_string(step.entityWorkflow, step.transitionAfter) %} - {% set transition_labels = workflow_metadata(step.entityWorkflow, 'label', transition) %} + {% set transition_labels = workflow_metadata(step.entityWorkflow, 'label', transition, step.entityWorkflow.workflowName) %} {% set transition_label = transition_labels is null ? step.transitionAfter : transition_labels|localize_translatable_string %} - {% set forward = workflow_metadata(step.entityWorkflow, 'isForward', transition) %} + {% set forward = workflow_metadata(step.entityWorkflow, 'isForward', transition, step.entityWorkflow.workflowName) %}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig index e3087769f..61189100c 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Workflow/macro_breadcrumb.html.twig @@ -44,7 +44,7 @@ {% endif %} {% if step.previous is not null %} {% set transition = chill_workflow_transition_by_string(step.entityWorkflow, step.previous.transitionAfter) %} - {% set labels = workflow_metadata(step.entityWorkflow, 'label', transition) %} + {% set labels = workflow_metadata(step.entityWorkflow, 'label', transition, step.entityWorkflow.workflowName) %} {% set label = labels is null ? step.previous.transitionAfter : labels|localize_translatable_string %} {{ label }} {% endif %} @@ -53,7 +53,7 @@ {% macro breadcrumb(_ctx) %}