Skip to content

Commit

Permalink
Reset the context evaluation after setting the entity.
Browse files Browse the repository at this point in the history
  • Loading branch information
DDEV User committed Jun 17, 2024
1 parent e13e957 commit 843f61c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Utility/DgiUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ public function executeEntityReactions(string $reaction_type, ContentEntityInter
*/
public function getActiveReactionsForEntity(string $reaction_type, ContentEntityInterface $entity) {
$this->provider->setEntity($entity);

// XXX: Need to force context re-evaluation to ensure that the entity being
// set by the provider in a single threaded scenario is evaluated once
// it has been changed.
$context_manager = new \ReflectionClass($this->contextManager);
$reset_context = $context_manager->getMethod('resetContextEvaluation');
$reset_context->setAccessible(TRUE);
$reset_context->invoke($this->contextManager);
$this->contextManager->evaluateContexts();
return $this->contextManager->getActiveReactions($reaction_type);
}
Expand Down

0 comments on commit 843f61c

Please sign in to comment.