_getInfo($name, $value, $attribs); if (!empty($info['defaultText']) && (!isset($info['value']) || $info['value'] === '')) { $value = $info['defaultText']; } else { $value = isset($info['format']) ? $this->_formatValue($info['format'], $info['value'], $info['attribs']) : $info['value']; } return $this->_getOpenTag($info) . (($info['escape']) ? $this->view->escape($value) : $value) . $this->_getCloseTag($info); } protected function _formatValue($format, $value, $attribs = null) { $prefix = null; $suffix = null; $decimals = 2; if (isset($attribs['prefix'])) { $prefix = $attribs['prefix']; } if (isset($attribs['suffix'])) { $suffix = $attribs['suffix']; } if (isset($attribs['precision'])) { $decimals = $attribs['precision']; } if (is_array($format)) { if (isset($format['decimals'])) { $decimals = $format['decimals']; } } switch ($format) { case 'money': $prefix = isset($prefix) ? $prefix : '$'; $skipZeroDecimals = isset($attribs['skipZeroDecimals']) ? $attribs['skipZeroDecimals'] : true; $value = \Qs\Number::toMoney($value, $decimals, $skipZeroDecimals, $prefix); $prefix = null; break; case 'number': case 'numeric': $value = \Qs\Number::format($value, $decimals); break; } return $prefix . $value . $suffix; } protected function _getOpenTag($info) { if (isset($info['tag'])) { return '<' . $info['tag'] . ' id="' . $this->view->escape($info['id']) . '"' . $this->_htmlAttribs($info['attribs']) . '>'; } return ''; } protected function _getCloseTag($info) { if (isset($info['tag'])) { return ''; } return ''; } }