/
DeprecatedPageListGenerator.php
66 lines (57 loc) · 1.96 KB
/
DeprecatedPageListGenerator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
namespace Concrete\Core\Page\Sitemap;
use Concrete\Core\Attribute\Category\PageCategory;
use Concrete\Core\Page\Page;
/**
* @deprecated Don't use! Create your own PageListGenerator class instead
*/
class DeprecatedPageListGenerator extends PageListGenerator
{
/**
* @var callable|null
*/
private $deprecatedChecker = null;
/**
* @var array|null
*/
private $instances = null;
/**
* @param callable $deprecatedChecker
*/
public function setDeprecatedChecker(callable $deprecatedChecker)
{
$this->deprecatedChecker = $deprecatedChecker;
}
/**
* {@inheritdoc}
*
* @see \Concrete\Core\Page\Sitemap\PageListGenerator::canIncludePageInSitemap()
*/
public function canIncludePageInSitemap(Page $page)
{
$dc = $this->deprecatedChecker;
return $dc($page, $this->getInstances());
}
/**
* @return array
*/
private function getInstances()
{
if ($this->instances === null) {
$pageAttributeCaetegory = $this->app->make(PageCategory::class);
$this->instances = [
'navigation' => $this->app->make('helper/navigation'),
'dashboard' => $this->getDashboardHelper(),
'view_page' => $this->getViewPagePermissionKey(),
'guestGroup' => $this->getVisitorsUserGroup(),
'now' => $this->getNow(),
'ak_exclude_sitemapxml' => $this->getExcludeFromSiteMapAttributeKey(),
'ak_sitemap_changefreq' => $pageAttributeCaetegory->getAttributeKeyByHandle('sitemap_changefreq'),
'ak_sitemap_priority' => $pageAttributeCaetegory->getAttributeKeyByHandle('sitemap_priority'),
'guestGroupAE' => $this->getVisitorsUserGroupAccessEntity(),
'multilingualSections' => $this->isMultilingualEnabled() ? $this->getMultilingualSections() : [],
];
}
return $this->instances;
}
}