Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cakephp3: Render/Evaluate HTML inside label formhelper

How you place html inside label in cakephp3?

I need to achieve * Name:

using the code below

<?php
    echo $this->Form->input ( 'name', [ 
            'label' => [ 
                    'text' => '<span class="red">*</span> Name:',
                    'class' => 'col-sm-12 col-md-2 col-lg-1 control-label' 
            ],
            'class' => 'form-control',
            'rows' => 1 
    ] );
like image 783
MontrealDevOne Avatar asked Jan 16 '15 19:01

MontrealDevOne


1 Answers

Pretty much as always, use the escape option.

echo $this->Form->input('name', [ 
    'label' => [ 
        // ...
        'escape' => false
    ],
    // ...
]);
like image 72
ndm Avatar answered Oct 21 '22 03:10

ndm