How can I ensure that a custom view helper is used when rendering a template/element in an Ajax request? It’s about a customPaginatorHelper cake 4.5
You can overwrite already loaded Helpers in your src/View/AjaxView.php
via adding
$this->addHelper('Form', ['className' => 'MyForm']);
to your initialize()
method.
This will overwrite the default FormHelper
with your custom src/View/Helper/MyFormHelper.php
only inside your AjaxView.
Also see Controllers - 4.x on how you force specific actions to use the AjaxView, not the default AppView
yes it works, I actually have:
$this->viewBuilder()->setClassName(‘Ajax’);
Forgotten in the controller… thank you very much