Example #1
0
    $html .= Form::submit('Save', array('class' => 'btn btn-default'));
    $html .= Form::close();
    return $html;
});
/**
 * 
 * Render only the dynamically generated form fields. 
 * 
 * You have to manually add the Form::open() and Form::close() methods 
 * and add a submit button.
 * 
 */
Form::macro('renderFields', function (FormInterface $form, $errors = null) {
    $html = '';
    foreach ($form->all() as $child) {
        $html .= Form::formRow($child, $errors);
    }
    return $html;
});
/**
 * 
 * Render a single form field
 *
 * It converts the Symfony field elements to Laravel Form ones.
 * 
 */
Form::macro('formRow', function (FormInterface $form, $errors = null) {
    $html = '';
    $view = $form->createView();
    $vars = $view->vars;
    $type = $form->getConfig()->getType()->getInnerType()->getName();