Open modir opened 10 months ago
Replace the current chapter or extend it?
Extending will not be enough, rewriting is the right way here.
Example:
init
method to ensure that also custom elements with dependencies are availablepost
, so it is not necessary to specify itaction
attribute is incorrect here, because there is no URL helper available; the URL helper is available in a controller or view script, so set it thereThank you very much for the valuable feedback. I will change this in the evening.
The methods addElements
and addInputFilter
are not needed. These customs methods can be replaced with the init
method and by implementing the interface Laminas\InputFilter\InputFilterProviderInterface
.
* defining the `action` attribute is incorrect here, because there is no URL helper available; the URL helper is available in a controller or view script, so set it there
He was writing about this attribute: https://wiki.selfhtml.org/wiki/HTML/Attribute/action Which can be set there. Yes, it would probably be nicer if it is done in a controller, but it is not a must.
Yes, it would probably be nicer if it is done in a controller, but it is not a must.
Unfortunately, you are overlooking the crucial point: if the route is changed from contactus
to contact
, the action
is wrong and no longer works.
If the controller plugin Url
or the view helper Url
is used then router assemble the correct target. This means you do not need to update several places in the application and therefore the helpers for URL creation should always be used.
Comment from Froschdesign in the forum:
The forms and input filters in the book are independent of the application. This means that standard and custom validators, filters or form elements that require a database adapter or some other preparation for creation cannot be used.
Decision to make: Replace the current chapter or extend it?