$paramsString = $paramsString . " " . $key . ' = "' . $value . '"'; } } if ($class == '') { $class = 'panel panel-default'; } if ($id == null) { $id = ""; } return '<div class="' . $class . '" ' . $paramsString . ' data-toggle="modal" data-target="#modal-liste-update"> <div class="panel-heading"> <h3 class="panel-title">' . $title . '</h3> </div>'; }); HtmlFacade::macro('panelClose', function () { return '</div>'; }); FormFacade::macro('checkboxInsert', function ($name, $id, $text) { if ($name == null) { $name = ''; } if ($id == null) { $id = ''; } if ($text == null) { $text = ''; } return '<div class="checkbox"> <label> <input id="' . $id . '" name="' . $name . '" type="checkbox"> ' . $text . '</label> </div>';
}); /** * Generate menu element with localized label * * @param string $elementName * @param array $parameters * @param array $attributes* * @return string */ Html::macro('link_menu_translated', function ($elementName, array $parameters = array(), array $attributes = array()) { $label = trans(spine_config('spine.link_menu.lang_filename', 'menu') . '.' . $elementName); return Html::link_menu($elementName, $label, $parameters, $attributes); }); /** * Get yes|no localized string based on boolean representation of given value * * @param bool $value * @return string */ Html::macro('print_bool', function ($value) { return (bool) $value ? transpine('helpers.yes') : transpine('helpers.no'); }); /** * Get html for iconic (visual) version of boolean value * * @param bool $value * @return string */ Html::macro('visual_bool', function ($value) { return '<i class="fa ' . ((bool) $value ? 'fa-check-square-o done' : 'fa-square-o') . '"></i>'; });
<?php /* * Just a little helper to add the active class to the current route * in the administration side navbar */ use Illuminate\Support\Facades\Request; use Collective\Html\HtmlFacade as Html; Html::macro('activeState', function ($routes = array()) { foreach ($routes as $route) { if (strpos(Request::url(), route($route)) !== false) { return 'active'; } } return ''; });