Skip to content

Commit

Permalink
Meh, nasty hack for getting option labels for calculations on things …
Browse files Browse the repository at this point in the history
…like checkboxes.
  • Loading branch information
cheesegrits committed Feb 3, 2018
1 parent 84bee51 commit ba107ec
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion components/com_fabrik/models/element.php
Expand Up @@ -5497,7 +5497,39 @@ protected function formatCalcSplitLabels(&$results2, &$plugin, $type = '')
if ($plugin->hasSubElements)
{
// http://fabrikar.com/forums/index.php?threads/calculation-split-on-problem.40122/
$val->label = ($type != 'median') ? $plugin->getLabelForValue($val->label) : $plugin->getLabelForValue($key, $key);
$labelParts = explode(' & ', $val->label);
if (count($labelParts) > 1)
{
$label = $labelParts[1];
}
else
{
$label = $labelParts[0];
}

$label = FabrikWorker::JSONtoData($label);
$ls = array();

if (is_array($label))
{
foreach ($label as $l)
{
$ls[] = ($type != 'median') ? $plugin->getLabelForValue($l) : $plugin->getLabelForValue($key, $key);
}
}
else
{
$ls[] = ($type != 'median') ? $plugin->getLabelForValue($label) : $plugin->getLabelForValue($key, $key);
}

if (count($labelParts > 1))
{
$val->label = $labelParts[0] . ' & ' . implode(',', $ls);
}
else
{
$val->label = impode(',', $ls);
}
}
else
{
Expand Down

1 comment on commit ba107ec

@trob
Copy link

@trob trob commented on ba107ec Feb 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.