Line Endings
The form start and end tags will always have a PHP_EOL
appended to the output.
While this is an assumption, I found that it was beneficial.
This package does NOT assume you want line feeds at the end of your elements.
You may find that your HTML output looks poorly formatted due to missing line feeds.
To force a line feed at the end of an element, you can simply use the PHP_EOL
constant
or use the lf()
method, which does the same thing. The following are equivalent:
<?php echo $form->text() . PHP_EOL; ?>
<?php echo $form->text()->lf(); ?>
Automatic Line Endings
If you find you always want a line feed after each element and you are using
the $form
facade, you can set the form to autoLf. For example:
<?php
$form = new \Vespula\Form\Form();
$form->id('foo')->class('bar')->autoLf();
?>
<div>
<?php echo $form->begin(); ?>
<div>
<?php echo $form->text()->name('foo'); ?>
</div>
<?php echo $form->end(); ?>
</div>