We barely touched the template files and they are full of dead-weight that we carry around from version to version.
Since we prepare to release a new major version, we should take the opportunity to clean up these files.
The below suggestions mention only specific examples, but the refactoring should be done at project level, on all templates (where they apply).
Move form preparation from template to controller:
We barely touched the template files and they are full of dead-weight that we carry around from version to version. Since we prepare to release a new major version, we should take the opportunity to clean up these files. The below suggestions mention only specific examples, but the refactoring should be done at project level, on all templates (where they apply).
Move form preparation from template to controller:
Example:
Unless necessary, this should be executed from the controller.
So, this:
should look like this:
Since #468 parsing form elements contains an unnecessary step:
Example:
We can remove the two placeholder-related lines, so it becomes:
Then, if we are not doing anything else with the form element, we can also get rid of the variable:
Move Form / FormElement operations from template to controller / form:
If a form attribute might change, we should set them at controller level:
If a form element attribute can be determined at controller level, we should do so - see this example.