예제 #1
0
 /**
  * Format address in a specific way
  *
  * @param Address $address
  * @param string $type
  * @return string|null
  */
 public function format(Address $address, $type)
 {
     $formatType = $this->addressConfig->getFormatByCode($type);
     if (!$formatType || !$formatType->getRenderer()) {
         return null;
     }
     $this->eventManager->dispatch('customer_address_format', ['type' => $formatType, 'address' => $address]);
     return $formatType->getRenderer()->renderArray($address->getData());
 }