Skip to content

Commit

Permalink
Add in the fix to the old processor.
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-vessey committed Apr 9, 2024
1 parent 039969e commit 26e0b90
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Plugin/search_api/processor/EmbargoProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,17 @@ public function addFieldValues(ItemInterface $item) : void {
/** @var \Drupal\embargo\EmbargoStorageInterface $embargo_storage */
$embargo_storage = $this->entityTypeManager->getStorage('embargo');
$embargoes = $embargo_storage->getApplicableEmbargoes($entity);
$relevant_embargoes = array_filter(
$embargoes,
function (EmbargoInterface $embargo) use ($entity) {
return in_array($embargo->getEmbargoType(), match ($entity->getEntityTypeId()) {
'file', 'media' => [EmbargoInterface::EMBARGO_TYPE_FILE, EmbargoInterface::EMBARGO_TYPE_NODE],
'node' => [EmbargoInterface::EMBARGO_TYPE_NODE],
});
}
);

foreach ($embargoes as $embargo) {
foreach ($relevant_embargoes as $embargo) {
$this->getFieldsHelper()->extractFields($embargo->getTypedData(), $to_extract);
}

Expand Down

0 comments on commit 26e0b90

Please sign in to comment.