cakephp-4.x

Cakephp 4 input control statment: $this->Form->control


in cakephp 4 there is a statement/method like

$this->Form->control('address_id',['options' => $addresstypes...]....

which mainly works fine. I my case I would like to change the label of an select box to an external link.

Now safe, but in this case unfortunate adding the option:

'label' => '<a href="whatever">whatever</a>'

renders my link useless because due to safety reasons it translates to:

&lt;a href="whatever"&gt;whatever&lt;/a&gt;

Obvious is also that this is a nice feature except you want to turn a label into a link.

Anybody an idea? Otherwise I have to rewrite a couple of hundreds of $this->Form->control...

statements.

Thx


Solution

  • I can't find it explicitly documented for the label attribute, but if you add 'escape' => false to your options in such cases, that should take care of it.