Short description of the issue
When FieldtypeOptions field is included into the joinFields option, the returned value of the FieldtypeOptions field has the first option only. Even if the actual assigned values are multiple.
Steps to reproduce the issue
Steps to reproduce the issue:
- Create a FieldtypeOptions field with multivalue support. Let's call it a
days field and set the days of the week as options.
- Add the field to a template.
- Edit a page with that field and select more than one value.
- In the template file find the target page with
joinFields option with days field. Like below
<?php
$basicPages = $pages->find("id=1015", [
'joinFields' => [ 'days' ]
]);
foreach ($basicPages as $basicPage) {
echo "<h4>{$basicPage->title}: {$basicPage->id}</h4>";
foreach ( $basicPage->days as $day) {
echo $day->title;
echo "<br />";
}
}
Expected behavior
Expected to see multiple days listed that were assigned to the page in days field.
Actual behavior
Seeing only the first, single day.
Optional: Suggestion for a possible fix
I think we can fix it by handling a concatenated string of multiple option values in wakeupValue method of the FieldtypeOptions module.
Here is a possible fix #241.
Setup/Environment
- ProcessWire version: 3.0.203
- (Optional) PHP version: 7.4.30
- (Optional) MySQL version: mariadb:10.8.3
- (Optional) Any 3rd party modules that are installed and could be related to the issue: N/A