Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public function itemExists(ItemInterface $item, Batch $batch)
if (is_object($item->getContentObject())) {
return true;
}

$itemPath = $this->normalizePath($item->getReference());
foreach ($batch->getPages() as $page) {
if ($page->getBatchPath() == $item->getReference()) {
if ($this->normalizePath($page->getBatchPath()) === $itemPath) {
return true;
}
if ($page->getOriginalPath() == $item->getReference()) {
if ($this->normalizePath($page->getOriginalPath()) === $itemPath) {
return true;
}
}
Expand All @@ -32,4 +32,9 @@ public function addMissingItemMessage(ItemInterface $item, MessageCollection $me
new Message(t('Referenced page at path %s cannot be found in the site or in the current content batch.', $item->getReference()), Message::E_WARNING)
);
}

private function normalizePath(?string $path): string
{
return '/' . ltrim($path ?? '', '/');
}
}