Example #1
0
 protected function getAttributeValue(Varien_Object $object)
 {
     $attribute = $this->getAttribute();
     if (empty($attribute)) {
         return null;
     }
     /** @var Mage_Sales_Model_Order_Address $object */
     if ($object instanceof Mage_Sales_Model_Order_Address && $attribute === 'all') {
         $value = $object->format("text");
     } else {
         $value = $object->getDataUsingMethod($attribute);
     }
     if (is_scalar($value)) {
         // Convert 2+ spaces in a row into a single space
         $value = preg_replace('/ {2,}/u', ' ', $value);
         // Remove leading/trailing spaces
         $value = trim($value);
     }
     return $value;
 }