TYPO3 CMS  TYPO3_6-2
ContainerElementView.php
Go to the documentation of this file.
1 <?php
3 
23 
29  protected $containerWrap = '
30  <ol>
31  <elements />
32  </ol>
33  ';
34 
42  public function getChildElements(\DOMDocument $dom) {
43  $modelChildren = $this->model->getElements();
44  $documentFragment = NULL;
45  foreach ($modelChildren as $key => $modelChild) {
46  $child = $this->createChildElementFromModel($modelChild);
47  if ($child) {
48  if ($child->noWrap() === TRUE) {
49  $childNode = $child->render();
50  } else {
51  $childNode = $child->render('elementWrap');
52  if ($childNode) {
53  $childNode->setAttribute('class', $child->getElementWraps());
54  }
55  }
56  if ($childNode) {
57  $importedNode = $dom->importNode($childNode, TRUE);
58  if (!$documentFragment) {
59  $documentFragment = $dom->createDocumentFragment();
60  }
61  $documentFragment->appendChild($importedNode);
62  }
63  }
64  }
65  return $documentFragment;
66  }
67 
74  public function createChildElementFromModel($modelChild) {
75  $childElement = NULL;
76  $class = \TYPO3\CMS\Form\Utility\FormUtility::getInstance()->getLastPartOfClassName($modelChild);
77  $className = 'TYPO3\\CMS\\Form\\View\\Confirmation\\Element\\' . ucfirst($class) . 'ElementView';
78  if (class_exists($className)) {
79  $childElement = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className, $modelChild);
80  }
81  return $childElement;
82  }
83 
84 }