1 | <?php |
||
20 | class FileSearchFormFactory implements FormFactory |
||
21 | { |
||
22 | use Extensible; |
||
23 | use Injectable; |
||
24 | |||
25 | public function __construct() |
||
29 | |||
30 | /** |
||
31 | * Generates the form |
||
32 | * |
||
33 | * @param Controller $controller Parent controller |
||
34 | * @param string $name |
||
35 | * @param array $context List of properties which may influence form scaffolding. |
||
36 | * E.g. 'Record' if building a form for a record. |
||
37 | * Custom factories may support more advanced parameters. |
||
38 | * @return Form |
||
39 | */ |
||
40 | public function getForm(Controller $controller, $name = FormFactory::DEFAULT_NAME, $context = []) |
||
41 | { |
||
42 | $fields = $this->getFormFields($controller, $name, $context); |
||
43 | $actions = FieldList::create(); |
||
44 | $form = Form::create($controller, $name, $fields, $actions); |
||
45 | $form->disableSecurityToken(); // not posted back, so unnecessary |
||
46 | $form->addExtraClass('form--no-dividers'); |
||
47 | $this->invokeWithExtensions('updateForm', $form, $controller, $name, $context); |
||
48 | return $form; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * |
||
53 | * @param Controller $controller |
||
54 | * @param $name |
||
55 | * @param array $context |
||
56 | * @return FieldList |
||
57 | */ |
||
58 | protected function getFormFields(Controller $controller, $name, $context = []) |
||
102 | |||
103 | |||
104 | /** |
||
105 | * Return list of mandatory context keys |
||
106 | * |
||
107 | * @return mixed |
||
108 | */ |
||
109 | public function getRequiredContext() |
||
113 | } |
||
114 |