/
LimitationFormMapperInterface.php
47 lines (43 loc) · 1.52 KB
/
LimitationFormMapperInterface.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
44
45
46
47
<?php
/**
* This file is part of the eZ RepositoryForms package.
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace EzSystems\RepositoryForms\Limitation;
use eZ\Publish\API\Repository\Values\User\Limitation;
use Symfony\Component\Form\FormInterface;
/**
* Interface for LimitationType form mappers.
*
* It maps a LimitationType's supported values to editing form.
*/
interface LimitationFormMapperInterface
{
/**
* "Maps" Limitation form to current LimitationType, in order to display one or several fields
* representing limitation values supported by the LimitationType.
*
* Implementors MUST either:
* - Add a "limitationValues" form field
* - OR add field(s) that map to "limitationValues" property from $data.
*
* @param FormInterface $form Form for current Limitation.
* @param Limitation $data Underlying data for current Limitation form.
*/
public function mapLimitationForm(FormInterface $form, Limitation $data);
/**
* Returns the Twig template to use to render the limitation form.
*
* @return string
*/
public function getFormTemplate();
/**
* This method will be called when FormEvents::SUBMIT is called.
* It gives the opportunity to filter/manipulate limitation values.
*
* @param Limitation $limitation
*/
public function filterLimitationValues(Limitation $limitation);
}