Ejemplo n.º 1
0
 /**
  * @param DataTransportPublic $publicData
  * @param DataTransportProtected $protectedData
  * @return mixed|void
  */
 protected function process(DataTransportPublic $publicData, DataTransportProtected $protectedData)
 {
     if (is_array($protectedData['meta'])) {
         foreach ($protectedData['meta'] as $meta) {
             $this->meta->add($meta);
         }
     }
     $publicData->setAttributes(array('title' => $this->title->getTitle() ?: $protectedData['title'], 'meta' => $this->prepareMeta($this->meta->getData()), 'scripts' => $protectedData['scripts'], 'styles' => $protectedData['styles']));
 }
Ejemplo n.º 2
0
 /**
  * @param array $elements
  * @param string $path
  * @return array
  */
 protected function processElements(array $elements, $path = '')
 {
     $result = [];
     $elements = $this->sortElements($elements);
     foreach ($elements as $elementName => $elementsConfig) {
         $elementPath = "{$path}/{$elementName}";
         $attributes = ['path' => $elementPath];
         if (is_array($elementsConfig)) {
             $children = [];
             if (!empty($elementsConfig)) {
                 $attributes += $this->extractElementAttributes($elementsConfig);
             }
             if (!empty($elementsConfig)) {
                 $children += $this->processElements($elementsConfig, $elementPath);
             }
             $this->dataTransportChildren->setAttributes($children);
         }
         $this->dataTransportProtected->setAttributes($attributes);
         $typeModel = $this->factory->resolve($this->dataTransportProtected['type']);
         $result[$elementName] = $typeModel->processOutput($this->dataTransportPublic, $this->dataTransportProtected, $this->dataTransportChildren);
         $this->dataTransportPublic->clearAttributes();
         $this->dataTransportProtected->clearAttributes();
         $this->dataTransportChildren->clearAttributes();
     }
     return $result;
 }