Пример #1
0
 /**
  * @param ModelInterface $block
  * @return mixed|string
  */
 private function determineAnonymousBlockId(ModelInterface $block)
 {
     $blockId = $block->getOption('block_id');
     if (!$blockId) {
         $blockId = sprintf(self::ANONYMOUS_ID_PATTERN, $block->captureTo(), self::$anonymousSuffix++);
         $block->setOption('block_id', $blockId);
     }
     return $blockId;
 }
Пример #2
0
 /**
  * retrieve parent and capture_to as array, e.g.: [ 'layout', 'content' ]
  * so we are able to list() block_id and capture_to values
  *
  * @param   ModelInterface  $block
  * @return  array
  */
 protected function getCaptureTo(ModelInterface $block)
 {
     $captureTo = $block->captureTo();
     if ($parent = $block->getOption('parent')) {
         $captureTo = explode(self::CAPTURE_TO_DELIMITER, $captureTo);
         return [$parent, end($captureTo)];
     }
     if (false !== strpos($captureTo, self::CAPTURE_TO_DELIMITER)) {
         return explode(self::CAPTURE_TO_DELIMITER, $captureTo);
     }
     return [self::BLOCK_ID_ROOT, $captureTo];
 }