Exemplo n.º 1
0
 public function apply($transformer, $context_element, $node)
 {
     $h2 = H2::create();
     if (Type::is($context_element, array(Header::getClassName(), Caption::getClassName()))) {
         $context_element->withSubTitle($h2);
     } elseif (Type::is($context_element, InstantArticle::getClassName())) {
         $context_element->addChild($h2);
     }
     if ($this->getProperty(Caption::POSITION_BELOW, $node)) {
         $h2->withPosition(Caption::POSITION_BELOW);
     }
     if ($this->getProperty(Caption::POSITION_CENTER, $node)) {
         $h2->withPosition(Caption::POSITION_CENTER);
     }
     if ($this->getProperty(Caption::POSITION_ABOVE, $node)) {
         $h2->withPosition(Caption::POSITION_ABOVE);
     }
     if ($this->getProperty(Caption::ALIGN_LEFT, $node)) {
         $h2->withTextAlignment(Caption::ALIGN_LEFT);
     }
     if ($this->getProperty(Caption::ALIGN_CENTER, $node)) {
         $h2->withTextAlignment(Caption::ALIGN_CENTER);
     }
     if ($this->getProperty(Caption::ALIGN_RIGHT, $node)) {
         $h2->withTextAlignment(Caption::ALIGN_RIGHT);
     }
     $transformer->transform($h2, $node);
     return $context_element;
 }
Exemplo n.º 2
0
 /**
  * This sets figcaption tag as documentation. It overrides all sets
  * made with Caption.
  *
  * @param Caption $caption the caption the video will have
  * @see Caption.
  * @return $this
  */
 public function withCaption($caption)
 {
     Type::enforce($caption, Caption::getClassName());
     $this->caption = $caption;
     return $this;
 }
Exemplo n.º 3
0
 public function testIsInSet()
 {
     $result = Type::is(Caption::create(), [Caption::getClassName(), InstantArticle::getClassName(), Video::getClassName(), Image::getClassName()]);
     $this->assertTrue($result);
 }
 public function getContextClass()
 {
     return Caption::getClassName();
 }