mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
normalizer for entityworkflow
This commit is contained in:
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\MainBundle\Workflow\Helper;
|
||||
|
||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflowStep;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Symfony\Component\Workflow\Registry;
|
||||
use Symfony\Component\Workflow\WorkflowInterface;
|
||||
@@ -51,16 +52,17 @@ class MetadataExtractor
|
||||
return $workflowsList;
|
||||
}
|
||||
|
||||
public function buildArrayPresentationForPlace(EntityWorkflow $entityWorkflow): array
|
||||
public function buildArrayPresentationForPlace(EntityWorkflow $entityWorkflow, ?EntityWorkflowStep $step = null): array
|
||||
{
|
||||
$workflow = $this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName());
|
||||
$step ??= $entityWorkflow->getCurrentStep();
|
||||
|
||||
$markingMetadata = $workflow->getMetadataStore()->getPlaceMetadata($entityWorkflow->getCurrentStep()->getCurrentStep());
|
||||
$markingMetadata = $workflow->getMetadataStore()->getPlaceMetadata($step->getCurrentStep());
|
||||
|
||||
$text = array_key_exists('label', $markingMetadata) ?
|
||||
$this->translatableStringHelper->localize($markingMetadata['label']) : $entityWorkflow->getCurrentStep()->getCurrentStep();
|
||||
$this->translatableStringHelper->localize($markingMetadata['label']) : $step->getCurrentStep();
|
||||
|
||||
return ['name' => $entityWorkflow->getCurrentStep()->getCurrentStep(), 'text' => $text];
|
||||
return ['name' => $step->getCurrentStep(), 'text' => $text];
|
||||
}
|
||||
|
||||
public function buildArrayPresentationForWorkflow(WorkflowInterface $workflow): array
|
||||
|
Reference in New Issue
Block a user