TYPO3 CMS  TYPO3_7-6
CompatibilityLayerUtility.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 
20 
26 {
31  public static function create(FormBuilder $formBuilder)
32  {
34  $compatibilityService = \TYPO3\CMS\Form\Utility\FormUtility::getObjectManager()->get(self::class);
35  $compatibilityService->setFormBuilder($formBuilder);
36  return $compatibilityService;
37  }
38 
44  protected $layout = [];
45 
49  protected $formBuilder;
50 
55  'TEXTLINE',
56  'SUBMIT',
57  'RESET',
58  'RADIO',
59  'PASSWORD',
60  'IMAGEBUTTON',
61  'FILEUPLOAD',
62  'CHECKBOX',
63  'BUTTON',
64  'TEXTAREA',
65  'HIDDEN',
66  'CONTENTELEMENT',
67  'TEXTBLOCK',
68  'SELECT',
69  'FIELDSET',
70  'RADIOGROUP',
71  'CHECKBOXGROUP',
72  ];
73 
77  protected $elementsWithoutLabel = [
78  'HIDDEN',
79  'CONTENTELEMENT',
80  'TEXTBLOCK',
81  'FIELDSET',
82  'RADIOGROUP',
83  'CHECKBOXGROUP',
84  ];
85 
89  protected $containerElements = [
90  'FIELDSET',
91  'RADIOGROUP',
92  'CHECKBOXGROUP',
93  ];
94 
98  public function setFormBuilder(FormBuilder $formBuilder)
99  {
100  $this->formBuilder = $formBuilder;
101  }
102 
110  public function setGlobalLayoutConfiguration($layout = [])
111  {
112  GeneralUtility::deprecationLog('EXT:form: Do not use "layout." anymore. Deprecated since TYPO3 CMS 7, this function will be removed in TYPO3 CMS 8.');
113  if (is_array($layout)) {
114  foreach ($layout as $elementType => $elementValue) {
115  $elementType = strtoupper($elementType);
116  $this->layout[$elementType] = $elementValue;
117  }
118  }
119  }
120 
130  public function getGlobalLayoutByElementType($elementType)
131  {
132  GeneralUtility::deprecationLog('EXT:form: Do not use "layout." anymore. Deprecated since TYPO3 CMS 7, this function will be removed in TYPO3 CMS 8.');
133  $layout = '';
134  if (!empty($this->layout[$elementType])) {
135  $layout = $this->layout[$elementType];
136  } else {
137  $action = $this->formBuilder->getControllerAction();
138  switch ($elementType) {
139  case 'FORM':
140  $layout = '<form><containerWrap /></form>';
141  break;
142  case 'CONFIRMATION':
143  $layout = '<containerWrap />';
144  break;
145  case 'HTML':
146  $layout = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><table cellspacing="0"><containerWrap /></table></body></html>';
147  break;
148  case 'CONTAINERWRAP':
149  if ($action !== 'process') {
150  $layout = '<ol><elements /></ol>';
151  } else {
152  $layout = '<tbody><elements /></tbody>';
153  }
154  break;
155  case 'ELEMENTWRAP':
156  if ($action !== 'process') {
157  $layout = '<li><element /></li>';
158  } else {
159  $layout = '<tr><element /></tr>';
160  }
161  break;
162  case 'LABEL':
163  if ($action === 'show') {
164  $layout = '<label><labelvalue /><mandatory /><error /></label>';
165  } elseif ($action === 'confirmation') {
166  $layout = '<label><labelvalue /></label>';
167  } else {
168  $layout = '<em><labelvalue /></em>';
169  }
170  break;
171  case 'LEGEND':
172  if ($action === 'show') {
173  $layout = '<legend><legendvalue /><mandatory /><error /></legend>';
174  } elseif ($action === 'confirmation') {
175  $layout = '<legend><legendvalue /></legend>';
176  } else {
177  $layout = '<thead><tr><th colspan="2" align="left"><legendvalue /></th></tr></thead>';
178  }
179  break;
180  case 'MANDATORY':
181  if ($action !== 'process') {
182  $layout = '<em><mandatoryvalue /></em>';
183  } else {
184  $layout = '';
185  }
186  break;
187  case 'ERROR':
188  if ($action !== 'process') {
189  $layout = '<strong><errorvalue /></strong>';
190  } else {
191  $layout = '';
192  }
193  break;
194  case 'RADIOGROUP':
195  case 'CHECKBOXGROUP':
196  case 'FIELDSET':
197  if ($action !== 'process') {
198  $layout = '<fieldset><legend /><containerWrap /></fieldset>';
199  } else {
200  $layout = '<td colspan="2"><table cellspacing="0" style="padding-left: 20px; margin-bottom: 20px;"><legend /><containerWrap /></table></td>';
201  }
202  break;
203  case 'HIDDEN':
204  if ($action !== 'process') {
205  $layout = '<input />';
206  } else {
207  $layout = '';
208  }
209  break;
210  case 'SELECT':
211  if ($action === 'show') {
212  $layout = '<label /><select><elements /></select>';
213  } elseif ($action === 'confirmation') {
214  $layout = '<label /><ol><elements /></ol>';
215  } else {
216  $layout = '<td style="width: 200px;"><label /></td><td><elements /></td>';
217  }
218  break;
219  case 'TEXTAREA':
220  if ($action === 'show') {
221  $layout = '<label /><textarea />';
222  } elseif ($action === 'confirmation') {
223  $layout = '<label /><inputvalue />';
224  } else {
225  $layout = '<td style="width: 200px;" valign="top"><label /></td><td><inputvalue /></td>';
226  }
227  break;
228  case 'BUTTON':
229  case 'IMAGEBUTTON':
230  case 'PASSWORD':
231  case 'RESET':
232  case 'SUBMIT':
233  if ($action !== 'show') {
234  $layout = '';
235  break;
236  }
237  case 'CHECKBOX':
238  case 'FILEUPLOAD':
239  case 'RADIO':
240  case 'TEXTLINE':
241  if ($action === 'show') {
242  $layout = '<label /><input />';
243  } elseif ($action === 'confirmation') {
244  $layout = '<label /><inputvalue />';
245  } else {
246  $layout = '<td style="width: 200px;"><label /></td><td><inputvalue /></td>';
247  }
248  break;
249  case 'TEXTBLOCK':
250  if ($action === 'show') {
251  $layout = '<textblock />';
252  } else {
253  $layout = '';
254  }
255  break;
256  }
257  }
258  return $layout;
259  }
260 
270  public function setElementLayouts(Element $element, array $userConfiguredElementTyposcript = [])
271  {
272  GeneralUtility::deprecationLog('EXT:form: Do not use "layout." anymore. Deprecated since TYPO3 CMS 7, this function will be removed in TYPO3 CMS 8.');
273  if ($element->getElementType() === 'FORM') {
274  $containerWrapReturn = $this->replaceTagWithMarker('elements', 'body', $this->getGlobalLayoutByElementType('CONTAINERWRAP'));
275  if ($this->formBuilder->getControllerAction() === 'show') {
276  $formWrapReturn = $this->replaceTagWithMarker('containerwrap', 'form', $this->getGlobalLayoutByElementType('FORM'));
277  } elseif ($this->formBuilder->getControllerAction() === 'confirmation') {
278  $formWrapReturn = $this->replaceTagWithMarker('containerwrap', 'body', $this->getGlobalLayoutByElementType('CONFIRMATION'));
279  } else {
280  $formWrapReturn = $this->replaceTagWithMarker('containerwrap', 'html', $this->getGlobalLayoutByElementType('HTML'));
281  }
282  $formLayout = str_replace($formWrapReturn['marker'], $containerWrapReturn['html'], $formWrapReturn['html']);
283  $formContainerWrap = explode($containerWrapReturn['marker'], $formLayout);
284  $layout['containerInnerWrap'] = $formContainerWrap;
285  $element->setLayout($layout);
286  $classFromLayout = $this->getElementClassFromLayout('form');
287  if (!empty($classFromLayout)) {
288  if (!empty($element->getAdditionalArgument('class'))) {
289  $classFromLayout .= ' ' . $element->getAdditionalArgument('class');
290  }
291  $element->setAdditionalArgument('class', $classFromLayout);
292  }
293  return;
294  }
295  if (in_array($element->getElementType(), $this->registeredFormElements)) {
296  /* Get the element layout definition or fallback to the global definition (if set) */
297  if (isset($userConfiguredElementTyposcript['layout'])) {
298  $elementLayout = $userConfiguredElementTyposcript['layout'];
299  } else {
300  $elementLayout = $this->getGlobalLayoutByElementType($element->getElementType());
301  }
302  /* if a element layout exist */
303  $elementWrap = null;
304  if ($elementLayout) {
305  $elementWrap = $this->determineElementOuterWraps($element->getElementType(), $elementLayout);
306  if ($elementWrap['html'] !== '') {
307  /* layout.label */
308  if (!in_array($element->getElementType(), $this->elementsWithoutLabel, true)) {
309  $descriptionElementLayouts = $this->getDescriptionElementLayouts($element);
310 
311  if (!$descriptionElementLayouts['labelContainContent']) {
312  $descriptionElementLayouts['labelLayout'] = '';
313  } else {
314  $libxmlUseInternalErrors = libxml_use_internal_errors(true);
315  $dom = new \DOMDocument('1.0', 'utf-8');
316  $dom->formatOutput = true;
317  $dom->preserveWhiteSpace = false;
318  if ($dom->loadXML($descriptionElementLayouts['labelLayout'])) {
319  $nodes = $dom->getElementsByTagName('label');
320  if ($nodes->length) {
321  $node = $nodes->item(0);
322  if ($node) {
323  $node->setAttribute('for', $element->getId());
324  $descriptionElementLayouts['labelLayout'] = $dom->saveXML($dom->firstChild);
325  }
326  }
327  }
328  libxml_use_internal_errors($libxmlUseInternalErrors);
329  }
330  /* Replace <label />, <error /> and <mandatory /> in the element wrap html */
331  $labelReturn = $this->replaceTagWithMarker('label', 'body', $elementWrap['html']);
332  if ($labelReturn['html'] !== '') {
333  $elementWrap['html'] = str_replace($labelReturn['marker'], $descriptionElementLayouts['labelLayout'], $labelReturn['html']);
334  }
335  $errorReturn = $this->replaceTagWithMarker('error', 'body', $elementWrap['html']);
336  if ($errorReturn['html'] !== '') {
337  $elementWrap['html'] = str_replace($errorReturn['marker'], $descriptionElementLayouts['errorLayout'], $errorReturn['html']);
338  }
339  $mandatoryReturn = $this->replaceTagWithMarker('mandatory', 'body', $elementWrap['html']);
340  if ($mandatoryReturn['html'] !== '') {
341  $elementWrap['html'] = str_replace($mandatoryReturn['marker'], $descriptionElementLayouts['mandatoryLayout'], $mandatoryReturn['html']);
342  }
343  }
344  $elementWrap = explode($elementWrap['marker'], $elementWrap['html']);
345  } else {
346  $elementWrap = null;
347  }
348  }
349  /* Set element outer wraps and set the default classes */
350  $elementOuterWrap = null;
351  if ($this->getGlobalLayoutByElementType('ELEMENTWRAP')) {
352  $libxmlUseInternalErrors = libxml_use_internal_errors(true);
353  $dom = new \DOMDocument('1.0', 'utf-8');
354  $dom->formatOutput = true;
355  $dom->preserveWhiteSpace = false;
356  if ($dom->loadXML($this->getGlobalLayoutByElementType('ELEMENTWRAP'))) {
357  $node = $dom->firstChild;
358  if ($node) {
359  $class = '';
360  if ($node->getAttribute('class') !== '') {
361  $class = $node->getAttribute('class') . ' ';
362  }
363  $class .= 'csc-form-' . $element->getElementCounter() . ' csc-form-element csc-form-element-' . $element->getElementTypeLowerCase();
364  $node->setAttribute('class', $class);
365  $elementOuterWrap = $dom->saveXML($dom->firstChild);
366  $return = $this->replaceTagWithMarker('element', 'body', $elementOuterWrap);
367  if ($return['marker'] !== '') {
368  $elementOuterWrap = explode($return['marker'], $return['html']);
369  if ($element->getElementType() === 'SELECT') {
370  $layout = $element->getLayout();
371  $layout['optionOuterWrap'] = $elementOuterWrap;
372  $element->setLayout($layout);
373  }
374  } else {
375  /* this should never be happen */
376  $elementOuterWrap = null;
377  }
378  }
379  } else {
380  $elementOuterWrap = null;
381  }
382  libxml_use_internal_errors($libxmlUseInternalErrors);
383  }
384 
385  if (
386  $elementWrap
387  && !$elementOuterWrap
388  ) {
389  /* If only $elementWrap isset */
390  $layout = $element->getLayout();
391  $layout['elementOuterWrap'] = $elementWrap;
392  $element->setLayout($layout);
393  } elseif (
394  !$elementWrap
395  && $elementOuterWrap
396  ) {
397  /* If only $elementOuterWrap isset */
398  $layout = $element->getLayout();
399  $layout['elementOuterWrap'] = $elementOuterWrap;
400  $element->setLayout($layout);
401  } elseif (
402  $elementWrap
403  && $elementOuterWrap
404  ) {
405  /* If $elementWrap isset and $elementOuterWrap isset */
406  $elementWrap = [
407  $elementOuterWrap[0] . $elementWrap[0],
408  $elementWrap[1] . $elementOuterWrap[1],
409  ];
410  $layout = $element->getLayout();
411  $layout['elementOuterWrap'] = $elementWrap;
412  $element->setLayout($layout);
413  }
414 
415  /* Set container inner wraps */
416  if (in_array($element->getElementType(), $this->containerElements)) {
417  $elementWrap = $this->determineElementOuterWraps($element->getElementType(), $elementLayout);
418  /* Replace the legend value */
419  $descriptionElementLayouts = $this->getDescriptionElementLayouts($element, 'legend');
420  if (!$descriptionElementLayouts['labelContainContent']) {
421  $descriptionElementLayouts['labelLayout'] = '';
422  }
423  /* No fieldset tag exist.
424  * Ignore CONTAINERWRAP
425  * */
426  if ($elementWrap['html'] === '') {
427  $containerWrapReturn = $this->replaceTagWithMarker('elements', 'body', $elementLayout);
428  if ($containerWrapReturn['marker'] && $containerWrapReturn['html']) {
429  /* Replace <legend /> in the element wrap html */
430  $legendReturn = $this->replaceTagWithMarker('legend', 'body', $containerWrapReturn['html']);
431  if ($legendReturn['html'] !== '') {
432  $containerWrapReturn['html'] = str_replace($legendReturn['marker'], $descriptionElementLayouts['labelLayout'], $legendReturn['html']);
433  }
434  $containerWrap = explode($containerWrapReturn['marker'], $containerWrapReturn['html']);
435  } else {
436  $containerWrap = ['', ''];
437  }
438 
439  $layout = $element->getLayout();
440  $layout['containerInnerWrap'] = $containerWrap;
441  $layout['noFieldsetTag'] = true;
442  $layout['legend'] = $descriptionElementLayouts['labelLayout'];
443  $element->setLayout($layout);
444  } else {
445  /* set the wraps */
446  $containerOuterWrap = ['', ''];
447  $containerOuterWrap = explode($elementWrap['marker'], $elementWrap['html']);
448  $containerWrapReturn = $this->replaceTagWithMarker('elements', 'body', $this->getGlobalLayoutByElementType('CONTAINERWRAP'));
449  $containerInnerWrap = explode($containerWrapReturn['marker'], $containerWrapReturn['html']);
450 
451  $containerWrap = [
452  $containerOuterWrap[0] . $containerInnerWrap[0],
453  $containerInnerWrap[1] . $containerOuterWrap[1],
454  ];
455 
456  $layout = $element->getLayout();
457  $layout['containerInnerWrap'] = $containerWrap;
458  $layout['legend'] = $descriptionElementLayouts['labelLayout'];
459  $element->setLayout($layout);
460  $classFromLayout = $this->getElementClassFromLayout('fieldset');
461  if (!empty($classFromLayout)) {
462  if (!empty($element->getHtmlAttribute('class'))) {
463  $classFromLayout .= ' ' . $element->getHtmlAttribute('class');
464  }
465  $element->setHtmlAttribute('class', $classFromLayout);
466  }
467  }
468  } else {
469  /* set class attribute for the element tag */
470  if ($this->formBuilder->getControllerAction() === 'show') {
471  if ($elementType === 'TEXTAREA') {
472  $tagName = 'textarea';
473  } elseif ($elementType === 'SELECT') {
474  $tagName = 'select';
475  } else {
476  $tagName = 'input';
477  }
478 
479  $classFromLayout = $this->getElementClassFromLayout($element->getElementType(), $tagName);
480  if (!empty($classFromLayout)) {
481  if (!empty($element->getAdditionalArgument('class'))) {
482  $classFromLayout .= ' ' . $element->getAdditionalArgument('class');
483  }
484  $element->setAdditionalArgument('class', $classFromLayout);
485  }
486  }
487  }
488  }
489  }
490 
499  protected function replaceLabelContent($scope = '', array $messages)
500  {
501  $messages = implode(' - ', $messages);
502  $return = $this->replaceTagWithMarker($scope . 'value', 'body', $this->getGlobalLayoutByElementType(strtoupper($scope)));
503  $html = str_replace($return['marker'], $messages, $return['html']);
504  return $html;
505  }
506 
517  protected function getDescriptionElementLayouts(Element $element, $scope = 'label')
518  {
519  $labelLayout = $this->getGlobalLayoutByElementType(strtoupper($scope));
520  $labelContainContent = false;
521  $mandatoryLayout = '';
522  $errorLayout = '';
523  if ($this->formBuilder->getControllerAction() === 'show') {
524  /* Replace the mandatory and error messages */
525  /* layout.mandatory */
526  $mandatoryMessages = $this->formBuilder->getValidationBuilder()->getMandatoryValidationMessagesByElementName($element->getName());
527  if (!empty($mandatoryMessages)) {
528  $mandatoryLayout = $this->replaceLabelContent('mandatory', $mandatoryMessages);
529  }
530  $mandatoryReturn = $this->replaceTagWithMarker('mandatory', 'body', $labelLayout);
531  if (!empty($mandatoryReturn['html'])) {
532  if (!empty($mandatoryLayout)) {
533  $labelContainContent = true;
534  }
535  $labelLayout = str_replace($mandatoryReturn['marker'], $mandatoryLayout, $mandatoryReturn['html']);
536  }
537 
538  /* layout.error */
539  $errorMessages = $element->getValidationErrorMessages();
540  if (!empty($errorMessages)) {
541  $errorLayout = $this->replaceLabelContent('error', $errorMessages);
542  }
543  $errorReturn = $this->replaceTagWithMarker('error', 'body', $labelLayout);
544  if (!empty($errorReturn['html'])) {
545  if (!empty($errorLayout)) {
546  $labelContainContent = true;
547  }
548  $labelLayout = str_replace($errorReturn['marker'], $errorLayout, $errorReturn['html']);
549  }
550  }
551  /* Replace the label value */
552  $labelValueReturn = $this->replaceTagWithMarker($scope . 'value', 'body', $labelLayout);
553  if (!empty($labelValueReturn['html'])) {
554  if (!empty($element->getAdditionalArgument($scope))) {
555  $labelContainContent = true;
556  }
557  $labelLayout = str_replace($labelValueReturn['marker'], $element->getAdditionalArgument($scope), $labelValueReturn['html']);
558  }
559 
560  return [
561  'labelContainContent' => $labelContainContent,
562  'labelLayout' => $labelLayout,
563  'errorLayout' => $errorLayout,
564  'mandatoryLayout' => $mandatoryLayout
565  ];
566  }
567 
575  protected function getElementClassFromLayout($elementType = '', $tagName = '')
576  {
577  $class = '';
578  $libxmlUseInternalErrors = libxml_use_internal_errors(true);
579  $dom = new \DOMDocument('1.0', 'utf-8');
580  $dom->formatOutput = true;
581  $dom->preserveWhiteSpace = false;
582  if ($dom->loadXML($this->getGlobalLayoutByElementType(strtoupper($elementType)))) {
583  if ($tagName === '') {
584  $tagName = $elementType;
585  }
586  $nodes = $dom->getElementsByTagName($tagName);
587  if ($nodes->length) {
588  $node = $nodes->item(0);
589  if ($node && $node->getAttribute('class') !== '') {
590  $class = $node->getAttribute('class');
591  }
592  }
593  }
594  libxml_use_internal_errors($libxmlUseInternalErrors);
595  return $class;
596  }
597 
607  protected function determineElementOuterWraps($elementType, $elementLayout = '')
608  {
609  if ($this->formBuilder->getControllerAction() === 'show') {
610  if ($elementType === 'TEXTAREA') {
611  $return = $this->replaceTagWithMarker('textarea', 'body', $elementLayout);
612  } elseif ($elementType === 'CONTENTELEMENT') {
613  $return = $this->replaceTagWithMarker('content', 'body', $elementLayout);
614  } elseif ($elementType === 'SELECT') {
615  $return = $this->replaceTagWithMarker('select', 'body', $elementLayout);
616  } elseif (in_array($elementType, $this->containerElements)) {
617  $return = $this->replaceTagWithMarker('fieldset', 'body', $elementLayout);
618  } else {
619  $return = $this->replaceTagWithMarker('input', 'body', $elementLayout);
620  }
621  } else {
622  if ($elementType === 'CONTENTELEMENT') {
623  $return = $this->replaceTagWithMarker('content', 'body', $elementLayout);
624  } elseif ($elementType === 'SELECT') {
625  $return = $this->replaceTagWithMarker('elements', 'body', $elementLayout);
626  } elseif (in_array($elementType, $this->containerElements)) {
627  if ($this->formBuilder->getControllerAction() === 'confirmation') {
628  $return = $this->replaceTagWithMarker('fieldset', 'body', $elementLayout);
629  } else {
630  $return = $this->replaceTagWithMarker('containerwrap', 'body', $elementLayout);
631  }
632  } else {
633  $return = $this->replaceTagWithMarker('inputvalue', 'body', $elementLayout);
634  }
635  }
636  return $return;
637  }
638 
647  protected function replaceTagWithMarker($tagName, $stopTag = 'body', $html = '')
648  {
649  if (
650  $tagName === ''
651  || $html === ''
652  ) {
653  return [
654  'html' => '',
655  'marker' => ''
656  ];
657  }
658  $libxmlUseInternalErrors = libxml_use_internal_errors(true);
659  $dom = new \DOMDocument('1.0', 'utf-8');
660  $dom->preserveWhiteSpace = false;
661  if (!$dom->loadHTML('<?xml encoding="utf-8">' . $html)) {
662  libxml_use_internal_errors($libxmlUseInternalErrors);
663  return [
664  'html' => '',
665  'marker' => ''
666  ];
667  }
668  libxml_use_internal_errors($libxmlUseInternalErrors);
669  $nodes = $dom->getElementsByTagName($tagName);
670  if (!$nodes->length) {
671  return [
672  'html' => '',
673  'marker' => ''
674  ];
675  }
676  $nodeToReplace = $nodes->item(0);
677  /* Replace $tagname tag with a unique marker */
678  $marker = '###' . uniqid() . '###';
679  $markerNode = $dom->createTextNode($marker);
680  $replaceNode = $dom->createDocumentFragment();
681  $domNode = $dom->importNode($markerNode, true);
682  $replaceNode->appendChild($domNode);
683  $parentNode = $nodeToReplace->parentNode;
684  $parentNode->insertBefore($replaceNode, $nodeToReplace);
685  $parentNode->removeChild($nodeToReplace);
686  $nextParent = $parentNode;
687  /* Do not save the stop tag */
688  while ($nextParent !== null) {
689  if ($nextParent->tagName === $stopTag) {
690  break;
691  }
692  $nextParent = $nextParent->parentNode;
693  }
694  $html = '';
695  /* if stopTag == html, save the whole html */
696  if ($stopTag === 'html') {
697  $html = $nextParent->ownerDocument->saveHTML($nextParent);
698  } else {
699  /* do not save the stopTag */
700  $children = $nextParent->childNodes;
701  foreach ($children as $child) {
702  $html .= $nextParent->ownerDocument->saveHTML($child);
703  }
704  }
705  return [
706  'html' => $html,
707  'marker' => $marker
708  ];
709  }
710 
719  public function getNewAttributeName($elementType, $attributeName)
720  {
721  if ($elementType === 'OPTION') {
722  if ($attributeName === 'data') {
723  GeneralUtility::deprecationLog('EXT:form: Deprecated since TYPO3 CMS 7, use text instead of data to configure the OPTION text');
724  $attributeName = 'text';
725  }
726  } elseif ($elementType === 'TEXTAREA') {
727  if ($attributeName === 'data') {
728  GeneralUtility::deprecationLog('EXT:form: Deprecated since TYPO3 CMS 7, use text instead of data to configure the TEXTAREA value');
729  $attributeName = 'text';
730  }
731  } elseif ($elementType === 'TEXTBLOCK') {
732  if ($attributeName === 'content') {
733  GeneralUtility::deprecationLog('EXT:form: Deprecated since TYPO3 CMS 7, use text instead of content to configure the TEXTBLOCK value');
734  $attributeName = 'text';
735  }
736  }
737  return $attributeName;
738  }
739 }
getDescriptionElementLayouts(Element $element, $scope='label')
replaceTagWithMarker($tagName, $stopTag='body', $html='')
setElementLayouts(Element $element, array $userConfiguredElementTyposcript=[])
setHtmlAttribute($key='', $value=null)
Definition: Element.php:342
setAdditionalArgument($key='', $value=null)
Definition: Element.php:182