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\AlsoPurchasedBundle\Service\Layout\Configurator; |
14
|
|
|
|
15
|
|
|
use WellCommerce\Bundle\AlsoPurchasedBundle\Controller\Box\AlsoPurchasedBoxController; |
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 LastViewedBoxConfigurator |
22
|
|
|
* |
23
|
|
|
* @author Adam Piotrowski <[email protected]> |
24
|
|
|
*/ |
25
|
|
|
final class AlsoPurchasedBoxConfigurator extends AbstractLayoutBoxConfigurator |
26
|
|
|
{ |
27
|
|
|
public function __construct(AlsoPurchasedBoxController $controller) |
28
|
|
|
{ |
29
|
|
|
$this->controller = $controller; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function getType(): string |
33
|
|
|
{ |
34
|
|
|
return 'AlsoPurchased'; |
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.tip.also_purchased', |
43
|
|
|
])); |
44
|
|
|
|
45
|
|
|
$fieldset->addChild($builder->getElement('text_field', [ |
46
|
|
|
'name' => 'limit', |
47
|
|
|
'label' => 'layout_box.label.also_purchased.limit', |
48
|
|
|
]))->setValue($this->getValue($defaults, '[limit]', 4)); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|