예제 #1
0
 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;
 }
예제 #2
0
 public function onComponentTagBody(Component $component, ComponentTag &$tag)
 {
     $panelMarkup = $component->loadAssociatedMarkup();
     $panel = MarkupUtils::findPiconTag('panel', $panelMarkup, $component);
     if ($panel == null) {
         throw new \MarkupNotFoundException(sprintf("Found markup for panel %s however there is no picon:panel tag.", $component->getId(0)));
     }
     $tag->setChildren(array($panel));
 }
예제 #3
0
 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 onComponentTagBody(Component $component, ComponentTag &$tag)
 {
     $borderMarkup = $component->loadAssociatedMarkup();
     $border = MarkupUtils::findPiconTag('border', $borderMarkup, $component);
     if ($border == null) {
         throw new \MarkupNotFoundException(sprintf("Found markup for border %s however there is no picon:border tag.", $component->getId(0)));
     }
     $body = MarkupUtils::findPiconTag('body', $borderMarkup);
     if ($body == null) {
         throw new \RuntimeException('No picon:body tag was found in border.');
     }
     $body->setChildren($tag->getChildren());
     $tag->setChildren(array($border));
 }
예제 #5
0
 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;
 }
예제 #6
0
 public function __construct($name, $attributes = array())
 {
     parent::__construct($name, $attributes);
     $this->put('picon:id', str_replace(':', '_', $name));
 }
예제 #7
0
 public function resolve(MarkupContainer $container, ComponentTag &$tag)
 {
     return $this->getParent()->get($tag->getComponentTagId());
 }
예제 #8
0
 /**
  * Checks that a component tag as an attribute and that the attribute has the required value
  * Throws an IllegalStateException if it is not
  * @param ComponentTag $tag The tag to check
  * @param String $attribute The attribute to find
  * @param String $value The value the attribute will have
  */
 protected function checkComponentTagAttribute(ComponentTag $tag, $attribute, $value)
 {
     $attributes = $tag->getAttributes();
     if (!array_key_exists($attribute, $attributes) || $attributes[$attribute] != $value) {
         throw new \IllegalStateException(sprintf("An %s component can only be added to a tag with a %s of %s", get_called_class(), $attribute, $value));
     }
 }
예제 #9
0
 protected function onComponentTag(ComponentTag $tag)
 {
     $tag->setTagType(new XmlTagType(XmlTagType::OPEN));
     $this->checkComponentTag($tag, 'textarea');
     parent::onComponentTag($tag);
 }
예제 #10
0
 protected function onComponentTag(ComponentTag $tag)
 {
     $tag->setName('div');
     parent::onComponentTag($tag);
 }