/**
  * Register any application services.
  *
  * This service provider is a great spot to register your various container
  * bindings with the application. As you can see, we are registering our
  * "Registrar" implementation here. You can add your own bindings too!
  *
  * @return void
  */
 public function register()
 {
     parent::register();
     FormBuilder::macro('template', function ($template, $empty = false, $field = 'template') {
         $template_list = '';
         if ($empty) {
             $template_list[''] = '-';
         }
         $folder = base_path() . '/resources/views/site/';
         if (is_dir($folder)) {
             $iterator = new \DirectoryIterator($folder);
             foreach ($iterator as $fileinfo) {
                 if ($fileinfo->isFile() && !$fileinfo->isDot()) {
                     $file = explode('.', $fileinfo->getFilename());
                     array_pop($file);
                     $value = implode('.', $file);
                     $template_list[$value] = $value;
                 }
             }
         }
         if ($template_list) {
             return Form::select($field, $template_list, $template, ['class' => "form-control"]);
         }
         return '';
     });
 }
Exemplo n.º 2
0
 /**
  * Register a custom macro.
  *
  * @param string $name
  * @param callable $macro
  * @return void 
  * @static 
  */
 public static function macro($name, $macro)
 {
     \Collective\Html\FormBuilder::macro($name, $macro);
 }
 private function registerFormSubmit()
 {
     FormBuilder::macro('button_submit', function ($texte) {
         return FormBuilder::submit($texte, ['class' => 'btn btn-info pull-right']);
     });
 }
Exemplo n.º 4
0
    $addon .= "</span>";
    $element = Form::password($name, field_attributes($name, $attributes));
    $out = '<div class="input-group">';
    $out .= $end ? '' : $addon;
    $out .= $element;
    $out .= $end ? $addon : '';
    $out .= '</div>';
    return field_wrapper($name, $label, $out);
});
Form::macro('passwordFieldIconClean', function ($name, $label = NULL, $content = 'lock', $end = false, array $attributes = [], $value = NULL) {
    $addon = '<span class="input-group-addon">';
    $addon .= '<span class="fa fa-' . $content . '"></span>';
    $addon .= "</span>";
    $attributes = array_merge($attributes, ['placeholder' => $label]);
    $element = Form::password($name, field_attributes($name, $attributes));
    $out = '<div class="input-group">';
    $out .= $end ? '' : $addon;
    $out .= $element;
    $out .= $end ? $addon : '';
    $out .= '</div>';
    return field_wrapper($name, $out, '');
});
HTML::macro('modal', function ($id, $title, $msg, $confirm = 'Sim', $close = 'Fechar') {
    $out = '<div class="modal fade" id="' . $id . '">
        <div class="modal-dialog modal-sm">
        <div class="modal-content">
        <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">' . $title . '</h4>
        </div>
        <div class="modal-body">