I have a feeling this will be a very simple oversight somewhere... but I've been stuck on this for a couple of hours and it's driving me crazy.
...I can work around this... but my curiosity wont let me leave it alone.
I've created a custom field, Type: Checkboxes.
I've added a few checkboxes entries, filled out the "Text" and "Value" fields.
Set to "Do not display Automatically"
Selected them in the article and Saved it.
When I show the checkboxes in an override, I want to display the "Value" field, but the "Text" field is displayed instead.
Im using the results for <img> tags in the template. See my code below.
I've tried using $checkboxes->rawvalue which returns nothing.
Tried json_decode to get the rawvalue, but nothing.
Code: Select all
<?php foreach($this->item->jcfields as $jcfield) {
$item->jcFields[$jcfield->name] = $jcfield;
}
$checkboxes = $item->jcFields['colours'];
if (!empty($checkboxes->value)) {
$checkboxValues = explode(', ', $checkboxes->value);
foreach ($checkboxValues as $value) {
echo '<img src="/images/colour-swatches/' . $value . '.png" alt="' . $value . '">';
}
}
?>