本文整理汇总了PHP中plgFabrik_Element::preFormatFormJoins方法的典型用法代码示例。如果您正苦于以下问题:PHP plgFabrik_Element::preFormatFormJoins方法的具体用法?PHP plgFabrik_Element::preFormatFormJoins怎么用?PHP plgFabrik_Element::preFormatFormJoins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plgFabrik_Element
的用法示例。
在下文中一共展示了plgFabrik_Element::preFormatFormJoins方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preFormatFormJoins
/**
* Allows the element to pre-process a rows data before and join mergeing of rows
* occurs. Used in calc element to do cals on actual row rather than merged row
*
* @param string $element_data elements data for the current row
* @param object $row current row's data
*
* @since 3.0.5
*
* @return string formatted value
*/
public function preFormatFormJoins($element_data, $row)
{
$params = $this->getParams();
$format = trim($params->get('calc_format_string'));
/**
* $$$ hugh - the 'calculated value' bit is for legacy data that was created
* before we started storing a value when row is saved
*/
if ($params->get('calc_on_save_only', 0)) {
if ($format != '') {
$element_data = sprintf($format, $element_data);
}
return parent::preFormatFormJoins($element_data, $row);
} else {
$element = $this->getElement();
$cal = $params->get('calc_calculation', '');
$listModel = $this->getlistModel();
$formModel = $this->getFormModel();
$data = JArrayHelper::fromObject($row);
$data['rowid'] = $data['__pk_val'];
$data['fabrik'] = $formModel->getId();
/**
* $$$ hugh - trying to standardize on $data so scripts know where data is,
* need $d here for backward compat
*/
$d = $data;
$res = $listModel->parseMessageForRowHolder($cal, $data, true);
$res = @eval($res);
FabrikWorker::logEval($res, 'Caught exception on eval in ' . $element->name . '::renderListData() : %s');
if ($format != '') {
$res = sprintf($format, $res);
}
// $$$ hugh - need to set _raw, might be needed if (say) calc is being used as 'use_as_row_class'
// See comments in formatData() in table model, we might could move this to a renderRawListData() method.
$raw_name = $this->getFullName(false, true, false) . '_raw';
$row->{$raw_name} = str_replace(GROUPSPLITTER, ',', $res);
return parent::preFormatFormJoins($res, $row);
}
}