Skip to content
Snippets Groups Projects
Commit ebf801a2 authored by Jonathan Sacksick's avatar Jonathan Sacksick
Browse files

Issue #2876181 by flocondetoile: Field formatter for field state machine...

Issue #2876181 by flocondetoile: Field formatter for field state machine always return the state item value for the entity in the default language.
parent efeee08d
No related branches found
No related tags found
No related merge requests found
Pipeline #232143 passed
...@@ -18,6 +18,13 @@ class StateTransitionForm extends FormBase implements StateTransitionFormInterfa ...@@ -18,6 +18,13 @@ class StateTransitionForm extends FormBase implements StateTransitionFormInterfa
*/ */
protected $redirectDestination; protected $redirectDestination;
/**
* The entity repository.
*
* @var \Drupal\Core\Entity\EntityRepositoryInterface
*/
protected $entityRepository;
/** /**
* The entity. * The entity.
* *
...@@ -38,6 +45,7 @@ class StateTransitionForm extends FormBase implements StateTransitionFormInterfa ...@@ -38,6 +45,7 @@ class StateTransitionForm extends FormBase implements StateTransitionFormInterfa
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
$instance = parent::create($container); $instance = parent::create($container);
$instance->redirectDestination = $container->get('redirect.destination'); $instance->redirectDestination = $container->get('redirect.destination');
$instance->entityRepository = $container->get('entity.repository');
return $instance; return $instance;
} }
...@@ -52,7 +60,7 @@ class StateTransitionForm extends FormBase implements StateTransitionFormInterfa ...@@ -52,7 +60,7 @@ class StateTransitionForm extends FormBase implements StateTransitionFormInterfa
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setEntity(ContentEntityInterface $entity) { public function setEntity(ContentEntityInterface $entity) {
$this->entity = $entity; $this->entity = $this->entityRepository->getTranslationFromContext($entity);
return $this; return $this;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment