Example #1
0
    $options = [0 => 'Ninguna'];
    foreach ($tmp as $key => $value) {
        $options[$key] = $value;
    }
    return Form::selectFormGroup($name, $options, $title, $formname, $attributes);
});
Form::macro('theMediaFormGroup', function ($name, $title, $formname, $attributes) {
    $options = ['TelevisiĆ³n', 'PeriĆ³dico', 'Radio', 'Otro'];
    return Form::selectFormGroup($name, $options, $title, $formname, $attributes);
});
Form::macro('selectFormGroup', function ($name, $options, $title, $formname, $attr) {
    return "\n" . '<div class="form-group"' . "\n" . '	ng-class="{\'has-error\' : film_form.' . $name . '.$invalid }">' . "\n" . '	<label for="' . $name . '" class="col-sm-2 control-label text-right">' . $title . '</label>' . "\n" . '	<div class="col-sm-10">' . "\n" . Form::select($name, $options, null, $attr) . '	</div>' . "\n" . '</div>' . "\n";
});
/**
 * By default all the text area inputs have the widget CKEditor.
 *
 * If you do not want the CKEditor you must set the $attr['class'] = 'no-ckeditor'.
 */
Form::macro('textareaFormGroup', function ($name, $title, $formname, $attr) {
    $attr['class'] = isset($attr['class']) ? $attr['class'] : '';
    /**
     * If it does not has a ckeditor class then we add a full editor.
     */
    if (!Str::contains($attr['class'], 'ckeditor')) {
        $attr['class'] .= ' ckeditor-full';
    }
    return Form::wrapperInput($name, $title, Form::textarea($name, null, $attr));
});
Form::macro('wrapperInput', function ($name, $title, $input) {
    return "\n" . '<div class="form-group">' . "\n" . '	<label for="' . $name . '" class="col-sm-2 control-label text-right">' . $title . '</label>' . "\n" . '	<div class="col-sm-10">' . "\n" . '	' . $input . "\n" . '	</div>' . "\n" . '</div>' . "\n";
});