public function renderListData($data, &$thisRow)
{
$params = $this->getParams();
$groupModel = $this->getGroupModel();
$labeldata = array();
if (!$groupModel->isJoin() && $groupModel->canRepeat())
{
$opts = $this->_getOptionVals();
$name = $this->getFullName(false, true, false) . '_raw';
// If coming from fabrikemail plugin $thisRow is empty
if (isset($thisRow->$name))
{
$data = $thisRow->$name;
}
if (!is_array($data))
{
$data = json_decode($data, true);
}
foreach ($data as $d)
{
foreach ($opts as $opt)
{
if ($opt->value == $d)
{
$labeldata[] = $opt->text;
break;
}
}
}
}
else{
// $$$ hugh - $data may already be JSON encoded, so we don't want to double-encode.
if (!FabrikWorker::isJSON($data))
{
/*$$$ cookn22 - needed because of the foreach block below */
$labeldata[] = $data;
}
else
{
// $$$ hugh - yeah, I know, kinda silly to decode right before we encode,
// should really refactor so encoding goes in this if/else structure!
$labeldata = json_decode($data);
}
foreach ($labeldata as &$l)
{
/*
$$$ cookn22 - In some situations (like with the user plugin), the $data argument is apparently already set to the label value for the element and not the raw (database) value, in
which case this function shouldn't be called. However, I'm not sure if that's always the case (if $data is never equal to the raw value at this point),
so the workaround here is just to pass $l (or $data) for the $defaultLabel argument of getLabelForValue, so the function doesn't return null.
*/
$l = $this->getLabelForValue($l, $l);
}
}
$data = json_encode($labeldata);
// $$$ rob add links and icons done in parent::renderListData();
return parent::renderListData($data, $thisRow);
}