Ok here's the code:
<?php
echo $this->Form->templates([
'nestingLabel' => '{{input}}<label{{attrs}}>{{text}}</label>',
'formGroup' => '{{input}}{{label}}',
]);
echo $this->Form->hidden('thing_id', ['type' => 'text', 'value' => 1]);
foreach($things as $thing) {
echo $this->Form->radio('thing_id', [
[
'id' => 'thing-id-' . $thing->id,
'value' => $thing->id,
'text' => 'test',
'data-toggle' => 'button'
]
],
[
'label' => [
'class' => 'button radius',
'for' => 'thing-id-' . $thing->id,
'text' =>
'<figure><img src= ' . $thing->img . '/><figcaption>' .
$thing->title .
'</figcaption></figure>',
'escape' => false
],
'hiddenField' => false
]);
}
?>
This is the line that cakephp says is causing the error:
echo $this->Form->templates([
'nestingLabel' => '{{input}}{{text}}',
'formGroup' => '{{input}}{{label}}',
]);
Here's the error text:
Object of class Cake\View\Helper\FormHelper could not be converted to string
Any chance someone out there has come across this before?
So i ran this:
<?= $this->Form->templates([
'nestingLabel' => '{{input}}<label{{attrs}}>{{text}}</label>',
'formGroup' => '{{input}}{{label}}',
]) ?>
Without any of the other code in the form and still getting this error!
Warning (4096): Object of class Cake\View\Helper\FormHelper could not be converted to string [APP/Template/things/things/thing.ctp, line 17] Code Context include - APP/Template/things/things/thing.ctp, line 17 Cake\View\View::_evaluate() - CORE/src/View/View.php, line 992 Cake\View\View::_render() - CORE/src/View/View.php, line 952 Cake\View\View::render() - CORE/src/View/View.php, line 587 Cake\Controller\Controller::render() - CORE/src/Controller/Controller.php, line 611 Cake\Routing\Dispatcher::_invoke() - CORE/src/Routing/Dispatcher.php, line 120 Cake\Routing\Dispatcher::dispatch() - CORE/src/Routing/Dispatcher.php, line 87 [main] - ROOT/webroot/index.php, line 36