70 protected function parseXML(\DOMDocument $dom, \DOMNode $reference, $emptyElement = FALSE) {
71 $node = $reference->firstChild;
72 while (!is_null($node)) {
74 $nodeType = $node->nodeType;
75 $nodeName = $node->nodeName;
79 case XML_ELEMENT_NODE:
82 $containerWrap = $this->
render(
'containerWrap');
91 $replaceNode = $this->getChildElements($dom);
93 $node->parentNode->replaceChild($replaceNode, $node);
99 if (!strrchr(get_class($this),
'AdditionalElement')) {
100 if ($this->model->additionalIsSet($nodeName)) {
105 if (!$this->model->additionalIsSet($nodeName)) {
111 if (!strrchr(get_class($this),
'AdditionalElement')) {
112 if ($this->model->additionalIsSet($nodeName)) {
119 if (array_key_exists(
'checked', $this->model->getAllowedAttributes())) {
120 if (!$this->model->hasAttribute(
'checked')) {
121 $emptyElement = TRUE;
123 } elseif (array_key_exists(
'selected', $this->model->getAllowedAttributes()) && !$this->model->hasAttribute(
'selected')) {
124 $emptyElement = TRUE;
127 if ($inputValue !=
'') {
129 $node->parentNode->insertBefore($replaceNode, $node);
131 $emptyElement = TRUE;
139 $replaceNode = $dom->createTextNode($this->getAdditionalValue());
140 $node->parentNode->insertBefore($replaceNode, $node);
147 if ($node->hasChildNodes()) {
148 $emptyElement = $this->
parseXML($dom, $node, $emptyElement);
153 $node = $node->nextSibling;
156 $oldNode->parentNode->removeChild($oldNode);
159 return $emptyElement;
169 public function render($type =
'element', $returnFirstChild = TRUE) {
171 $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE);
172 $useLayout = $this->getLayout((
string) $type);
173 $dom = new \DOMDocument(
'1.0',
'utf-8');
174 $dom->formatOutput = TRUE;
175 $dom->preserveWhiteSpace = FALSE;
176 $dom->loadXML($useLayout);
177 $emptyElement = $this->
parseXML($dom, $dom);
178 libxml_disable_entity_loader($previousValueOfEntityLoader);
181 } elseif ($returnFirstChild) {
182 return $dom->firstChild;
194 public function getLayout($type) {
199 $layoutDefault = $this->layout;
200 $layout = $layoutHandler->getLayoutByObject(\
TYPO3\CMS\Form\Utility\FormUtility::getInstance()->getLastPartOfClassName($this, TRUE), $layoutDefault);
204 $elementWrap = $layoutHandler->getLayoutByObject($type, $layoutDefault);
205 $layout = str_replace(
'<element />', $this->getLayout(
'element'),
$elementWrap);
207 case 'containerWrap':
208 $layoutDefault = $this->containerWrap;
209 $layout = $layoutHandler->getLayoutByObject($type, $layoutDefault);
224 $replaceNode = $dom->createDocumentFragment();
225 $domNode = $dom->importNode($value, TRUE);
226 $replaceNode->appendChild($domNode);
227 $node->parentNode->insertBefore($replaceNode, $node);
238 $attributes = $this->model->getAttributes();
239 foreach ($attributes as $key => $attribute) {
240 if (!empty($attribute)) {
241 $value = htmlspecialchars($attribute->getValue(), ENT_QUOTES);
243 $domElement->setAttribute($key, $value);
257 $attribute = htmlspecialchars($this->model->getAttributeValue((
string) $key), ENT_QUOTES);
258 if (!empty($attribute)) {
259 $domElement->setAttribute($key, $attribute);
273 $attribute = htmlspecialchars($this->model->getAttributeValue((
string) $other), ENT_QUOTES);
274 if (!empty($attribute)) {
275 $domElement->setAttribute($key, $attribute);
286 $class = strtolower((
string) $class);
287 $className =
'TYPO3\\CMS\\Form\\View\\Confirmation\\Additional\\' . ucfirst($class) .
'AdditionalElementView';
288 return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className, $this->model);
299 return $additional->render();
306 if (method_exists($this->model,
'getData')) {
307 $inputValue = $this->model->getData();
309 $inputValue = $this->model->getAttributeValue(
'value');
311 $inputValue = htmlspecialchars($inputValue, ENT_QUOTES);
312 $inputValue = nl2br($inputValue, TRUE);
323 $elementId = (int)$this->model->getElementId();
324 $wrapId =
'csc-form-' . $elementId;
335 $elementType = strtolower(\
TYPO3\CMS\Form\Utility\FormUtility::getInstance()->getLastPartOfClassName($this->model));
336 $wrapType =
'csc-form-element csc-form-element-' . $elementType;
350 return implode(
' ', $wraps);
static makeInstance($className)