/
SearchProvider.php
75 lines (60 loc) · 1.69 KB
/
SearchProvider.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
67
68
69
70
71
72
73
74
75
<?php
namespace Concrete\Core\Page\Search;
use Concrete\Core\Attribute\Category\PageCategory;
use Concrete\Core\Page\PageList;
use Concrete\Core\Page\Search\ColumnSet\DefaultSet;
use Concrete\Core\Page\Search\Result\Result;
use Concrete\Core\Search\AbstractSearchProvider;
use Concrete\Core\Search\ProviderInterface;
use Concrete\Core\Page\Search\ColumnSet\Available;
use Concrete\Core\Page\Search\ColumnSet\ColumnSet;
use Symfony\Component\HttpFoundation\Session\Session;
use Concrete\Core\Entity\Search\SavedPageSearch;
class SearchProvider extends AbstractSearchProvider
{
protected $category;
public function getSessionNamespace()
{
return 'page';
}
public function __construct(PageCategory $category, Session $session)
{
$this->category = $category;
parent::__construct($session);
}
public function getCustomAttributeKeys()
{
return $this->category->getSearchableList();
}
public function getBaseColumnSet()
{
return new ColumnSet();
}
public function getAvailableColumnSet()
{
return new Available();
}
public function getCurrentColumnSet()
{
return ColumnSet::getCurrent();
}
public function createSearchResultObject($columns, $list)
{
return new Result($columns, $list);
}
public function getItemList()
{
$site = \Core::make('site')->getActiveSiteForEditing();
$list = new PageList();
$list->setSiteTreeObject($site);
return $list;
}
public function getDefaultColumnSet()
{
return new DefaultSet();
}
public function getSavedSearch()
{
return new SavedPageSearch();
}
}