Example #1
0
 function __construct($position, $blocks)
 {
     foreach (LayoutItem::splitClasses($position, ' ') as $classes) {
         $this->path[] = LayoutItem::splitClasses($classes);
     }
     $this->blocks = (array) $blocks;
 }
 /**
  * @param int   $key   The action key
  * @param int   $index The action index
  * @param array $args  The action arguments
  *
  * @return int The number of executed actions
  */
 protected function postExecuteAction($key, $index, $args)
 {
     switch ($key) {
         case self::ADD:
             $this->addCounter++;
             $this->item->initialize($args[0]);
             $this->registry->updateLayout($args[0], $this, $this->item);
             break;
         case self::ADD_ALIAS:
             $this->item->initialize($this->rawLayoutBuilder->resolveId($args[1]), $args[0]);
             $this->registry->updateLayout($args[0], $this, $this->item);
             break;
         case self::MOVE:
             $this->addCounter++;
             break;
         case self::REMOVE:
             $this->removeLink($key, $index, $args[0]);
             break;
     }
     return 0;
 }
Example #3
0
 function keyOf(LayoutItem $block, $parent = null)
 {
     $base = $key = (isset($parent) ? "{$parent} " : '') . $block->fullID();
     if (isset($this->result[$key])) {
         $i = 1;
         while (isset($this->result[$key = $base . ' ' . ++$i])) {
         }
     }
     return $key;
 }