/
menu.php
43 lines (35 loc) · 1.2 KB
/
menu.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
<?php
namespace Concrete\Controller\Element\Pages\Search;
use Concrete\Core\Controller\ElementController;
use Concrete\Core\Entity\Search\Query;
use Concrete\Core\Page\Search\SearchProvider;
use Concrete\Core\Form\Service\Form;
use Concrete\Core\Utility\Service\Url;
use Concrete\Core\Validation\CSRF\Token;
class Menu extends ElementController
{
protected $query;
protected $searchProvider;
public function __construct(SearchProvider $searchProvider)
{
parent::__construct();
$this->searchProvider = $searchProvider;
}
public function getElement()
{
return 'pages/search/menu';
}
public function setQuery(Query $query): void
{
$this->query = $query;
}
public function view()
{
$itemsPerPage = (isset($this->query)) ? $this->query->getItemsPerPage() : $this->searchProvider->getItemsPerPage();
$this->set('itemsPerPage', $itemsPerPage);
$this->set('itemsPerPageOptions', $this->searchProvider->getItemsPerPageOptions());
$this->set('form', $this->app->make(Form::class));
$this->set('token', $this->app->make(Token::class));
$this->set('urlHelper', $this->app->make(Url::class));
}
}