Esempio n. 1
0
 /**
  * @covers \Magento\Framework\View\Layout\ScheduledStructure::isElementsEmpty
  */
 public function testIsElementsEmpty()
 {
     $this->assertFalse($this->_model->isElementsEmpty());
     $this->_model->flushScheduledStructure();
     $this->assertTrue($this->_model->isElementsEmpty());
 }
Esempio n. 2
0
 /**
  * Create structure of elements from the loaded XML configuration
  *
  * @return void
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public function generateElements()
 {
     \Magento\Framework\Profiler::start(__CLASS__ . '::' . __METHOD__);
     \Magento\Framework\Profiler::start('build_structure');
     $this->_scheduledStructure->flushScheduledStructure();
     $this->_readStructure($this->getNode());
     $this->_addToOutputRootContainers($this->getNode());
     while (false === $this->_scheduledStructure->isStructureEmpty()) {
         $this->_scheduleElement(key($this->_scheduledStructure->getStructure()));
     }
     $this->_scheduledStructure->flushPaths();
     foreach ($this->_scheduledStructure->getListToMove() as $elementToMove) {
         $this->_moveElementInStructure($elementToMove);
     }
     foreach ($this->_scheduledStructure->getListToRemove() as $elementToRemove) {
         $this->_removeElement($elementToRemove);
     }
     \Magento\Framework\Profiler::stop('build_structure');
     \Magento\Framework\Profiler::start('generate_elements');
     while (false === $this->_scheduledStructure->isElementsEmpty()) {
         list($type, $node, $actions, $args, $attributes) = current($this->_scheduledStructure->getElements());
         $elementName = key($this->_scheduledStructure->getElements());
         if ($type == Element::TYPE_BLOCK) {
             $this->_generateBlock($elementName);
         } else {
             $this->_generateContainer($elementName, (string) $node[Element::CONTAINER_OPT_LABEL], $attributes);
             $this->_scheduledStructure->unsetElement($elementName);
         }
     }
     \Magento\Framework\Profiler::stop('generate_elements');
     \Magento\Framework\Profiler::stop(__CLASS__ . '::' . __METHOD__);
 }