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 = $dom->createDocumentFragment();
45  foreach ($modelChildren as $key => $modelChild) {
46  $child = $this->createChildElementFromModel($modelChild);
47  if ($child->noWrap() === TRUE) {
48  $childNode = $child->render();
49  } else {
50  $childNode = $child->render('elementWrap');
51  $class = '';
52  if (strlen($childNode->getAttribute('class')) > 0) {
53  $class = $childNode->getAttribute('class') . ' ';
54  }
55  $class .= $child->getElementWraps();
56  $childNode->setAttribute('class', $class);
57  }
58  $importedNode = $dom->importNode($childNode, TRUE);
59  $documentFragment->appendChild($importedNode);
60  }
61  return $documentFragment;
62  }
63 
70  public function createChildElementFromModel($modelChild) {
71  $childElement = NULL;
72  $class = \TYPO3\CMS\Form\Utility\FormUtility::getInstance()->getLastPartOfClassName($modelChild);
73  $className = 'TYPO3\\CMS\\Form\\View\\Form\\Element\\' . ucfirst($class) . 'ElementView';
74  if (class_exists($className)) {
75  $childElement = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className, $modelChild);
76  }
77  return $childElement;
78  }
79 
80 }