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\CmsBundle\Form\Admin; |
14
|
|
|
|
15
|
|
|
use WellCommerce\Bundle\CoreBundle\Form\AbstractFormBuilder; |
16
|
|
|
use WellCommerce\Component\Form\Elements\FormInterface; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class NewsCategoryFormBuilder |
20
|
|
|
* |
21
|
|
|
* @author Adam Piotrowski <[email protected]> |
22
|
|
|
*/ |
23
|
|
|
class NewsCategoryFormBuilder extends AbstractFormBuilder |
24
|
|
|
{ |
25
|
|
|
public function getAlias(): string |
26
|
|
|
{ |
27
|
|
|
return 'admin.news_category'; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function buildForm(FormInterface $form) |
31
|
|
|
{ |
32
|
|
|
$requiredData = $form->addChild($this->getElement('nested_fieldset', [ |
33
|
|
|
'name' => 'required_data', |
34
|
|
|
'label' => 'common.fieldset.general', |
35
|
|
|
])); |
36
|
|
|
|
37
|
|
|
$languageData = $requiredData->addChild($this->getElement('language_fieldset', [ |
38
|
|
|
'name' => 'translations', |
39
|
|
|
'label' => 'common.fieldset.translations', |
40
|
|
|
'transformer' => $this->getRepositoryTransformer('translation', $this->get('news_category.repository')), |
41
|
|
|
])); |
42
|
|
|
|
43
|
|
|
$languageData->addChild($this->getElement('text_field', [ |
44
|
|
|
'name' => 'name', |
45
|
|
|
'label' => 'common.label.name', |
46
|
|
|
'rules' => [ |
47
|
|
|
$this->getRule('required'), |
48
|
|
|
], |
49
|
|
|
])); |
50
|
|
|
|
51
|
|
|
$form->addFilter($this->getFilter('trim')); |
52
|
|
|
$form->addFilter($this->getFilter('secure')); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|