Exemple #1
0
 /**
  * Build the Image component.
  * 
  * @param array $options image's options.
  * @param closure $block closure to build customized image content.
  * @return ContentTag a ContentTag instance that represents a Image component.
  */
 private function build_image($options, $block)
 {
     if (!isset($options['alt']) || is_null($options['alt'])) {
         $options['alt'] = $this->get_alternative_image_text($options['src']);
     }
     $shape_class = $this->get_image_shape_class($options);
     $responsive_class = $this->get_responsive_class($options);
     Base::append_class($options, $shape_class);
     Base::append_class($options, $responsive_class);
     return is_null($block) ? new ContentTag('img', '', $options) : new ContentTag('img', $options, $block);
 }
Exemple #2
0
 /**
  * Builds a customized thumbnail (image + mixed content)
  * 
  * @param Image $image Image component.
  * @param array $options thumbnail's options.
  * @param closure $block Closure that generates the mixed content.
  * @return ContentTag instance of ContenTag that represents the customized thumbnail.
  */
 private function build_custom_thumbnail($image, &$options, $block)
 {
     Base::get_and_unset('href', $options);
     Base::append_class($options, 'thumbnail');
     $custom_thumbnail = new ContentTag('div', $options, function () use($image, $block) {
         return [$image, call_user_func($block)];
     });
     unset($options['class']);
     return $custom_thumbnail;
 }