TYPO3 CMS  TYPO3_7-6
FormJsonElement.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 {
27  public $xtype = 'typo3-form-wizard-elements-basic-form';
28 
34  public $configuration = [
35  'attributes' => [],
36  'prefix' => 'tx_form',
37  'confirmation' => true,
38  'postProcessor' => []
39  ];
40 
46  protected $allowedAttributes = [
47  'accesskey',
48  'class',
49  'contenteditable',
50  'contextmenu',
51  'dir',
52  'draggable',
53  'dropzone',
54  'hidden',
55  'id',
56  'lang',
57  'spellcheck',
58  'style',
59  'tabindex',
60  'title',
61  'translate',
62  /* element specific attributes */
63  'accept',
64  'accept-charset',
65  'action',
66  'autocomplete',
67  'enctype',
68  'method',
69  'novalidate'
70  ];
71 
79  public function setParameters(array $parameters)
80  {
81  parent::setParameters($parameters);
82  $this->setPrefix($parameters);
83  $this->setConfirmation($parameters);
84  $this->setPostProcessors($parameters);
85  }
86 
93  protected function setConfirmation(array $parameters)
94  {
95  if (isset($parameters['confirmation'])) {
96  $this->configuration['confirmation'] = $parameters['confirmation'];
97  }
98  }
99 
106  protected function setPostProcessors(array $parameters)
107  {
108  if (isset($parameters['postProcessor.']) && is_array($parameters['postProcessor.'])) {
109  $postProcessors = $parameters['postProcessor.'];
110  foreach ($postProcessors as $key => $postProcessorName) {
111  if ((int)$key && strpos($key, '.') === false) {
112  $postProcessorConfiguration = [];
113  if (isset($postProcessors[$key . '.'])) {
114  $postProcessorConfiguration = $postProcessors[$key . '.'];
115  }
116  $this->configuration['postProcessor'][$postProcessorName] = $postProcessorConfiguration;
117  }
118  }
119  } else {
120  $this->configuration['postProcessor'] = [
121  'mail' => [
122  'recipientEmail' => '',
123  'senderEmail' => ''
124  ]
125  ];
126  }
127  }
128 
135  protected function setPrefix(array $parameters)
136  {
137  if (isset($parameters['prefix'])) {
138  $this->configuration['prefix'] = $parameters['prefix'];
139  }
140  }
141 }