/
IncludePageAliasesField.php
42 lines (36 loc) · 1.21 KB
/
IncludePageAliasesField.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
<?php
namespace Concrete\Core\Page\Search\Field\Field;
use Concrete\Core\Search\Field\AbstractField;
use Concrete\Core\Search\ItemList\ItemList;
class IncludePageAliasesField extends AbstractField
{
protected $requestVariables = [
'includeAliases',
];
public function getKey()
{
return 'include_page_aliases';
}
public function getDisplayName()
{
return t('Include Page Aliases');
}
/**
* @param \Concrete\Core\Page\PageList $list
*/
public function filterList(ItemList $list)
{
if ($this->data['includeAliases'] === '1') {
$list->includeAliases();
}
}
public function renderSearchField()
{
$form = \Core::make('helper/form');
$html = '<div>';
$html .= '<div class="form-check">' . $form->radio('includeAliases', 0, $this->data['includeAliases']) . $form->label('includeAliases'.'1',t('No'), ['class'=>'form-check-label']) . '</div>';
$html .= '<div class="form-check">' . $form->radio('includeAliases', 1, $this->data['includeAliases']) . $form->label('includeAliases'.'2',t('Yes'), ['class'=>'form-check-label']) . '</div>';
$html .= '</div>';
return $html;
}
}