1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* WellCommerce Open-Source E-Commerce Platform |
4
|
|
|
* |
5
|
|
|
* This file is part of the WellCommerce package. |
6
|
|
|
* |
7
|
|
|
* (c) Adam Piotrowski <[email protected]> |
8
|
|
|
* |
9
|
|
|
* For the full copyright and license information, |
10
|
|
|
* please view the LICENSE file that was distributed with this source code. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace WellCommerce\Bundle\CatalogBundle\Service\Layout\Configurator; |
14
|
|
|
|
15
|
|
|
use WellCommerce\Bundle\CatalogBundle\Controller\Box\LayeredNavigationBoxController; |
16
|
|
|
use WellCommerce\Bundle\CoreBundle\Layout\Configurator\AbstractLayoutBoxConfigurator; |
17
|
|
|
use WellCommerce\Component\Form\Elements\FormInterface; |
18
|
|
|
use WellCommerce\Component\Form\FormBuilderInterface; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class LayeredNavigationBoxConfigurator |
22
|
|
|
* |
23
|
|
|
* @author Adam Piotrowski <[email protected]> |
24
|
|
|
*/ |
25
|
|
|
final class LayeredNavigationBoxConfigurator extends AbstractLayoutBoxConfigurator |
26
|
|
|
{ |
27
|
|
|
public function __construct(LayeredNavigationBoxController $controller) |
28
|
|
|
{ |
29
|
|
|
$this->controller = $controller; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function getType(): string |
33
|
|
|
{ |
34
|
|
|
return 'LayeredNavigation'; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function addFormFields(FormBuilderInterface $builder, FormInterface $form, $defaults) |
38
|
|
|
{ |
39
|
|
|
$fieldset = $this->getFieldset($builder, $form); |
40
|
|
|
|
41
|
|
|
$fieldset->addChild($builder->getElement('tip', [ |
42
|
|
|
'tip' => 'layout_box.layered_navigation.tip', |
43
|
|
|
])); |
44
|
|
|
|
45
|
|
|
$fieldset->addChild($builder->getElement('checkbox', [ |
46
|
|
|
'name' => 'enable_price_filter', |
47
|
|
|
'label' => 'layout_box.layered_navigation.enable_price_filter', |
48
|
|
|
]))->setValue($this->getValue($defaults, '[enable_price_filter]', true)); |
49
|
|
|
|
50
|
|
|
$fieldset->addChild($builder->getElement('checkbox', [ |
51
|
|
|
'name' => 'enable_brand_filter', |
52
|
|
|
'label' => 'layout_box.layered_navigation.enable_brand_filter', |
53
|
|
|
]))->setValue($this->getValue($defaults, '[enable_brand_filter]', true)); |
54
|
|
|
|
55
|
|
|
$fieldset->addChild($builder->getElement('checkbox', [ |
56
|
|
|
'name' => 'enable_attribute_filter', |
57
|
|
|
'label' => 'layout_box.layered_navigation.enable_attribute_filter', |
58
|
|
|
]))->setValue($this->getValue($defaults, '[enable_attribute_filter]', true)); |
59
|
|
|
|
60
|
|
|
$fieldset->addChild($builder->getElement('checkbox', [ |
61
|
|
|
'name' => 'enable_status_filter', |
62
|
|
|
'label' => 'layout_box.layered_navigation.enable_status_filter', |
63
|
|
|
]))->setValue($this->getValue($defaults, '[enable_status_filter]', true)); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|