Example #1
0
 /**
  * Renders grid column
  *
  * @param Varien_Object $row
  * @return mixed
  */
 public function _getValue(Varien_Object $row)
 {
     $format = $this->getColumn()->getFormat() ? $this->getColumn()->getFormat() : $row->getFormat();
     $defaultValue = $this->getColumn()->getDefault();
     if (is_null($format)) {
         // If no format and it column not filtered specified return data as is.
         $data = parent::_getValue($row);
         $string = is_null($data) ? $defaultValue : $data;
         return htmlspecialchars($string);
     } elseif (preg_match_all($this->_variablePattern, $format, $matches)) {
         // Parsing of format string
         $formatedString = $format;
         foreach ($matches[0] as $matchIndex => $match) {
             $value = $row->getData($matches[1][$matchIndex]);
             $formatedString = str_replace($match, $value, $formatedString);
         }
         return $formatedString;
     } else {
         return htmlspecialchars($format);
     }
 }