Skip to content

Commit 7867fd0

Browse files
authored
Merge pull request #67 from hissy/fix/63
Get pages by paths with site objects when importing additional pages into the existing sitemap
2 parents 1baa927 + 9779fc9 commit 7867fd0

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/Concrete/Backup/ContentImporter/ValueInspector/Item/BatchPageItem.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,21 @@ public function getContentObject()
2020
{
2121

2222
// First, does the passed path exist in the site? If so, we consider this solved
23-
// This is handled by the parent class
24-
$object = parent::getContentObject();
25-
if ($object) {
26-
return $object;
23+
$cPath = $this->getReference();
24+
$site = $this->batch->getSite();
25+
if ($cPath == '/' || $cPath == '') {
26+
if ($site) {
27+
return $site->getSiteHomePageObject('ACTIVE');
28+
} else {
29+
return Page::getByID(Page::getHomePageID(), 'ACTIVE');
30+
}
31+
}
32+
33+
$c = Page::getByPath($cPath, 'ACTIVE', $site);
34+
if (is_object($c) && !$c->isError()) {
35+
return $c;
2736
}
2837

29-
$cPath = $this->getReference();
3038
$entityManager = \ORM::entityManager();
3139

3240
// Now, let's check to see if the path matches the original path of a page in the batch

0 commit comments

Comments
 (0)