The error occurs when I nest multiple subform fields.
I wrote the following code to fix the issue:
// Flatten the value if it is an array (list, checkboxes, etc.), independent of render_values
if (is_array($subfield->value)) {
if (!empty($subfield->value)) {
$new_value = "";
array_walk_recursive($subfield->value, function ($value) use (&$new_value) {
$new_value .= $value . " ";
});
$subfield->value = trim($new_value);
} else {
$subfield->value = implode(' ', $subfield->value);
}
}
| Labels |
Removed:
?
|
||
| Labels |
Added:
No Code Attached Yet
|
||
@romeolandry please provide more information.
What error occur?
How did you create subform, using Content Custom field or with XML in your extension?
With the fields example.
| Labels |
Added:
Information Required
|
||
This error occure:
Warning: Array to string conversion in ....\plugins\fields\subform\src\Extension\Subform.php on line 235
Call Stack
1 0.0009 424520 {main}( ) ...\index.php:0
2 0.0037 437368 require_once( '....\includes\app.php ) ...\index.php:51
3 0.3238 7580464 Joomla\CMS\Application\CMSApplication->execute( ) ...\app.php:58
4 0.3373 7783928 Joomla\CMS\Application\SiteApplication->doExecute( ) ...\CMSApplication.php:304
5 0.8535 18080112 Joomla\CMS\Application\SiteApplication->dispatch( $component = ??? ) ...\SiteApplication.php:271
6 0.9121 18786848 Joomla\CMS\Component\ComponentHelper::renderComponent( $option = 'co...
I use the Content Custom field from joomla.
This are the images, how I create the custom Fielgs
sorry but I cannot upload my images
@Fedik As it is about subforms: Could you check this issue? I'm not sure if the proposed solution is right.