public function resolve(MarkupContainer $container, ComponentTag &$tag) { if ($tag instanceof PiconTag && ($tag->getName() == 'picon:extend' || $tag->getName() == 'picon:child')) { return new TransparentMarkupContainer($tag->getName() . $container->getPage()->getAutoIndex()); } return null; }
public function resolve(MarkupContainer $container, ComponentTag &$tag) { if ($tag instanceof PiconTag && $tag->getName() == 'picon:panel') { $id = 'panel' . $container->getPage()->getAutoIndex(); $tag->setComponentTagId($id); return new TransparentMarkupContainer($id); } return null; }
public function resolve(MarkupContainer $container, ComponentTag &$tag) { if ($tag instanceof PiconTag && $tag->getName() == 'head') { return new HeaderContainer(self::HEADER_ID); } else { if ($tag instanceof PiconTag && $tag->isHeaderTag()) { if ($container instanceof WebPage) { //@todo this block is UNTESTED $header = new HeaderContainer('header' . $container->getPage()->getAutoIndex()); $inner = new TransparentMarkupContainer('picon_header'); $inner->setRenderBodyOnly(true); $header->add($inner); return $header; } elseif ($container instanceof HeaderContainer) { $header = new TransparentMarkupContainer('picon_header'); $header->setRenderBodyOnly(true); return $header; } throw new \RuntimeException('<picon:head> tag was in an invalid location. It must be outside of <picon:extend> and <picon:panel>'); } } return null; }
/** * Checks that a component tag is a tag of the required name * Throws an IllegalStateException if it is not * @param ComponentTag $tag The tag to check * @param String $tagName The tag name that should match */ protected function checkComponentTag(ComponentTag $tag, $tagName) { if ($tag->getName() != $tagName) { throw new \IllegalStateException(sprintf("An %s component can only be added to the HTML element %s", get_called_class(), $tagName)); } }