2

I need to populate some entity value into the radio HTML code, I look through all documentation but does not seem to be able to find any help

below is the php code,

{{entity->description}}

is the entity value I want to show
$this->Form->setTemplates ( [ 
        'radioContainer' => '{{content}}' 
] );
echo $this->Form->control ( 'OrderShippingMethodId', 
[ 
            'templates' => [                
                'nestingLabel' => '**<p>{{entity->description}}</p>**
              {{input}}{{text}}',               
                'radioWrapper' => '{{label}}'       ],
        'options' => $shippingMethodsRadio,
        'type' => 'radio',
        'label' => false,
        'type' => 'radio',
        'id' => 'OrderShippingMethodId',
        'legend' => false ,
        'escape' => false

] );

it generate the below html code, the <p></p> is not showing the entity description value

Shipping

as can be seen in the bold code above, the entity->description value cannot be read out, seem that the only value the form->control can read out from the entity is text, value. is there anyway to access other value in the entity

in the controller method, to populate $shippingMethodsRadio

$this->set('shippingMethodsRadio' => $shippingMethods->extract('radio'));

the $shippingMethods, will contain a collection of the entity shippingMethod, I want to read other value like description property in the entity into the radio control, the radio property in the shippingMethod return an array contains value, text, description property of the entity to populate the radio control

thank you

cakephp_dev1
  • 159
  • 1
  • 6
  • Possible duplicate of [populate entity value into radio wrapper](https://stackoverflow.com/questions/46764827/populate-entity-value-into-radio-wrapper) – sskoko Oct 16 '17 at 08:49

0 Answers0