[BUGFIX] Don't override the class on the Form elementWrap 00/35400/2
authorMarc Neuhaus <mneuhaus@famelo.com>
Tue, 21 May 2013 07:49:37 +0000 (09:49 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 13 Dec 2014 19:53:41 +0000 (20:53 +0100)
This Changeset fixes an issue, which made it impossible
to give the layout.elementWrap a class attribute, because it
is was simple overridden.
Now it checks if a class is set and appends the default csc-form-*
classes instead of overriding it.

Resolves: #48404
Releases: master, 6.2
Change-Id: I20fec83d28b2e727f268ee00dab830c39c5f15a1
Reviewed-on: http://review.typo3.org/35400
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/form/Classes/View/Form/Element/ContainerElementView.php

index 1073615..c6597cf 100644 (file)
@@ -48,7 +48,12 @@ class ContainerElementView extends \TYPO3\CMS\Form\View\Form\Element\AbstractEle
                                $childNode = $child->render();
                        } else {
                                $childNode = $child->render('elementWrap');
-                               $childNode->setAttribute('class', $child->getElementWraps());
+                               $class = '';
+                               if (strlen($childNode->getAttribute('class')) > 0) {
+                                       $class = $childNode->getAttribute('class') . ' ';
+                               }
+                               $class .= $child->getElementWraps();
+                               $childNode->setAttribute('class', $class);
                        }
                        $importedNode = $dom->importNode($childNode, TRUE);
                        $documentFragment->appendChild($importedNode);