Ejemplo n.º 1
0
 function toHtml()
 {
     $thumb = Thumb::factory($this->vendor, $this->entity, $this->id, $this->name);
     $url = $thumb->getUrl($this->size);
     $img = \HtmlImg::addClass('img-rounded pointer img-responsive');
     //получим размеры
     $config_w = Arr::get($thumb->getConfig(), $this->size . '.size.w');
     $config_h = Arr::get($thumb->getConfig(), $this->size . '.size.h');
     if (!$url) {
         $img->setAttribute('data-src', 'holder.js/' . $config_w . 'x' . $config_h . '?theme=sky');
     } else {
         $img->setSrc($url . '?' . microtime(true));
     }
     $span = WidgetOverlay::factory()->setIcon('fa fa-crop')->setText('Обрезать миниатюру');
     return \HtmlDiv::addClass('thumb-cropper js-btn')->setAttribute('data-thumb-name', $this->name)->setAttribute('data-thumb-size', $this->size)->setAttribute('data-vendor', $this->vendor)->setAttribute('data-action', 'thumb_size')->setContent($span . $img)->__toString();
 }
Ejemplo n.º 2
0
 function toHtml()
 {
     $thumb = Thumb::factory($this->vendor, $this->entity, $this->id, $this->name);
     $url = $thumb->getUrl($this->size);
     $img = \HtmlImg::addClass($this->img_class);
     //получим размеры
     $config_w = Arr::get($thumb->getConfig(), $this->size . '.size.w');
     $config_h = Arr::get($thumb->getConfig(), $this->size . '.size.h');
     if (!$url) {
         $img->setAttribute('data-src', 'holder.js/' . $config_w . 'x' . $config_h . '?theme=sky');
     } else {
         $img->setSrc($url . '?' . microtime(true));
     }
     $span = WidgetOverlay::factory()->setIcon('fa fa-folder-open-o');
     //        $span = \HtmlSpan::setContent('<i class="fa fa-folder-open-o"></i>');
     return \HtmlDiv::addClass('js-btn box-overlay__wrap box-overlay__wrap--fade box-overlay__wrap--blue box-overlay__wrap--inline')->setAttribute('data-thumb-name', $this->name)->setAttribute('data-thumb-size', $this->size)->setAttribute('data-action', 'thumb_name')->setContent($span . $img)->__toString();
 }
Ejemplo n.º 3
0
});
Larakit\Twig::register_function('html_sub', function ($content = null) {
    return HtmlSub::setContent($content);
});
Larakit\Twig::register_function('html_ul', function ($items = []) {
    $list = HtmlUl::setContent(null);
    if (count($items)) {
        foreach ($items as $item) {
            $list->addItem($item);
        }
    }
    return $list;
});
Larakit\Twig::register_function('html_ol', function ($items = []) {
    $list = HtmlOl::setContent(null);
    if (count($items)) {
        foreach ($items as $item) {
            $list->addItem($item);
        }
    }
    return $list;
});
Larakit\Twig::register_function('html_table', function ($class = 'table table-striped table-bordered table-condensed') {
    return HtmlTable::addClass($class);
});
Larakit\Twig::register_function('html_image', function ($src = null) {
    return HtmlImg::setSrc($src);
});
Larakit\Twig::register_function('html_video', function ($src = null) {
    return HtmlVideo::setSrc($src);
});