return HtmlSup::setContent($content); }); 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);
function actionBelongsToMany($relation, $icon = 'fa fa-sitemap', $title = null) { if (!Acl::factory($this->model)->reason('edit')) { $list = \HtmlOl::addClass('js-hasmany'); foreach ($this->model->{$relation} as $item) { $list->addItem($item); } $model_class = get_class($this->model); if ($title) { $translated_title = $model_class::translate($title); } else { $translated_title = \Lang::get('larakit::relations.hint.belongs_to_many'); } $btn = \HtmlButton::setAttribute('data-action', 'belongs_to_many')->setAttribute('data-relation', $relation)->addClass('btn btn-primary btn-xs js-btn ')->setTitle($translated_title)->setContent('<i class="' . $icon . '"></i>'); return \HtmlDiv::addClass('row-fluid')->setContent(\HtmlDiv::addClass('pull-left')->setContent($btn) . \HtmlDiv::setContent($list)); } return ''; }