Prefered structure and indentation of form inputsΒΆ
When we have a variable core to the function we are calling, we keep it on the same line as the function call. For example the form name value in a Form:: or a routename in a linkRoute. If we make use of an Array it gets its own level of indentation.
Having this aggressive structuring and descriptive indentation makes the document longer (lines), which might hinder comprehension when skimmed through.
More importantly it makes it easier and more intuitive to edit individual parts of the code. Each entry should describe its function as thoroughly as possible. Sparse is better then dense.
Element ID always goes before classes and is then followed by type. Beyond that just try to keep it consistent throughout the document you are working in.
Comments can be omitted for reoccurring forms but are encouraged. It is better to copy the comment throughout the entire code than not having a comment at all.
Be sure to omit Input::old('name') when a input should not be restored upon session restoration.
1 2 3 4 5 6 7 8 9 | {{ // Comment
Form::text('FIELDNAME_GOES_HERE',
Input::old('FIELDNAME_GOES_HERE'),
array(
'id' => 'myID',
'class' => 'form-control',
'type' => 'text'
))
}}
|
This example only becomes a button because of the class, otherwise it is generated as a normal link.
1 2 3 4 5 6 7 8 9 | {{ // Comment
HTML::linkRoute('routename',
'ButtonText',
array("URL", "Arguments"),
array(
'class' => 'btn btn-info',
)
)
}}
|