public function draw() { if ($this->collapse) { $this->attributes['class'] .= ' collapsed-box'; } $attributes = HTML::attributes($this->attributes); $html = <<<BOX <div {$attributes}> <div class="box-header"> <h3 class="box-title">{$this->title}</h3> <div class="box-tools pull-right"> <button class="btn {$this->btn} btn-sm" data-widget="collapse"><i class="fa fa-minus"></i></button> <!-- <button class="btn {$this->btn} btn-sm" data-widget="remove"><i class="fa fa-times"></i></button> --> </div> </div> <div class="box-body" style="display: block;"> {$this->content} </div><!-- /.box-body --> </div> BOX; return $html; }
<?php /** Setting up for Namespacing **/ use Illuminate\Support\Facades\HTML; // Inspired by: http://forums.laravel.io/viewtopic.php?id=827 HTML::macro('nav_item', function ($url, $text, $a_attr = array(), $active_class = 'active', $li_attrs = array()) { $href = HTML::link($url, $text, $a_attr); $response = ''; if (Request::is($url) || Request::is($url . '/*')) { if (isset($li_attrs['class'])) { $li_attrs['class'] .= ' ' . $active_class; } else { $li_attrs['class'] = $active_class; } } return '<li ' . HTML::attributes($li_attrs) . '>' . $href . '</li>'; });
/** * @return mixed */ public function formgroup() { $hidden = $this->isHide() ? 'display:none;' : ''; $hasError = $this->hasError() ? 'has-error' : ''; $options = $this->form_group; $options['class'] .= ' ' . $hasError; $options['class'] .= $this->colClass(); $options['style'] .= $hidden; return HTML::attributes($options); }
/** * 表格换行 * @param array $attributes * @return $this */ public function tr($attributes = []) { $tr = new \stdClass(); $tr->attributes = HTML::attributes($attributes); $tr->children = $this->tr; $this->tbody[] = $tr; $this->tr = []; return $this; }
/** * Get HTML attribute data. * * @return mixed */ public function getAttributes() { return HTML::attributes($this->attributes); }