forked from remp2020/remp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIGenerator.php
56 lines (46 loc) · 1.23 KB
/
IGenerator.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
48
49
50
51
52
53
54
55
56
<?php
namespace Remp\MailerModule\Generators;
use Nette\Application\UI\Form;
use Nette\Utils\ArrayHash;
use Tomaj\NetteApi\Params\InputParam;
interface IGenerator
{
/**
* generates additional form elements based on the Generator type. If generator adds custom submit element,
* it should return array of tabs in format [linkToTab => label].
*
* @param Form $form
* @return string|null
*/
public function generateForm(Form $form);
/**
* @param callable $onSubmit
* @return void
*/
public function onSubmit(callable $onSubmit);
/**
* Return widget classes
* @return string[]
*/
public function getWidgets();
/**
* Returns available parameters that generator needs
*
* @return InputParam[]
*/
public function apiParams();
/**
* Generates output data from input values object
* Used by both Form POST and API call
*
* @return array
*/
public function process($values);
/**
* Generates parameters for generator from arbitrary object (e.g. WP article dump)
* Each generator can define its own rules
*
* @return array
*/
public function preprocessParameters($data): ?ArrayHash;
}