/** * Represent customer address in 'online' format. * * @param \Magento\Customer\Api\Data\AddressInterface $address * @return string */ public function getAddressAsString(\Magento\Customer\Api\Data\AddressInterface $address) { $formatTypeRenderer = $this->_addressHelper->getFormatTypeRenderer('oneline'); $result = ''; if ($formatTypeRenderer) { $result = $formatTypeRenderer->renderArray($this->addressMapper->toFlatArray($address)); } return $this->escapeHtml($result); }
/** * Represent customer address in HTML format. * * @param \Magento\Customer\Api\Data\AddressInterface $address * @return string */ public function getAddressAsHtml(\Magento\Customer\Api\Data\AddressInterface $address) { $formatTypeRenderer = $this->_customerAddressHelper->getFormatTypeRenderer('html'); $result = ''; if ($formatTypeRenderer) { $result = $formatTypeRenderer->renderArray($this->addressMapper->toFlatArray($address)); } return $result; }
/** * Represent customer address in 'online' format. * * @param \Magento\Customer\Service\V1\Data\Address $addressData * @return string */ public function getAddressAsString($addressData) { $formatTypeRenderer = $this->_addressHelper->getFormatTypeRenderer('oneline'); $result = ''; if ($formatTypeRenderer) { $result = $formatTypeRenderer->renderArray(AddressConverter::toFlatArray($addressData)); } return $this->escapeHtml($result); }
/** * @return string|null */ public function getBillingAddressHtml() { try { $address = $this->_addressService->getAddress($this->getCustomer()->getDefaultBilling()); } catch (NoSuchEntityException $e) { return __('The customer does not have default billing address.'); } return $this->_addressHelper->getFormatTypeRenderer('html')->renderArray(AddressConverter::toFlatArray($address)); }
/** * Represent customer address in HTML format. * * @param \Magento\Customer\Service\V1\Data\Address $addressData * @return string */ public function getAddressAsHtml($addressData) { $formatTypeRenderer = $this->_customerAddressHelper->getFormatTypeRenderer('html'); $result = ''; if ($formatTypeRenderer) { $result = $formatTypeRenderer->renderArray(AddressConverter::toFlatArray($addressData)); } return $result; }
/** * Retrieve billing address html * * @return \Magento\Framework\Phrase|string */ public function getBillingAddressHtml() { try { $address = $this->accountManagement->getDefaultBillingAddress($this->getCustomer()->getId()); } catch (NoSuchEntityException $e) { return __('The customer does not have default billing address.'); } if ($address === null) { return __('The customer does not have default billing address.'); } return $this->addressHelper->getFormatTypeRenderer('html')->renderArray($this->addressMapper->toFlatArray($address)); }
/** * Format the given address to the given type * * @param AddressInterface $address * @param string $type * @return string */ public function format(AddressInterface $address, $type) { return $this->_addressHelper->getFormatTypeRenderer($type)->renderArray($this->addressMapper->toFlatArray($address)); }
/** * @param string $code * @param \Magento\Customer\Block\Address\Renderer\RendererInterface|null $result * @dataProvider getFormatTypeRendererDataProvider */ public function testGetFormatTypeRenderer($code, $result) { $this->addressConfig->expects($this->once())->method('getFormatByCode')->with($code)->will($this->returnValue(new \Magento\Framework\Object(!is_null($result) ? array('renderer' => $result) : array()))); $this->assertEquals($result, $this->helper->getFormatTypeRenderer($code)); }
/** * Format the given address to the given type * * @param Address $address * @param string $type * @return string */ public function format(Address $address, $type) { return $this->_addressHelper->getFormatTypeRenderer($type)->renderArray(AddressConverter::toFlatArray($address)); }