本文整理汇总了PHP中Magento\Customer\Helper\Address::getFormatTypeRenderer方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::getFormatTypeRenderer方法的具体用法?PHP Address::getFormatTypeRenderer怎么用?PHP Address::getFormatTypeRenderer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Customer\Helper\Address
的用法示例。
在下文中一共展示了Address::getFormatTypeRenderer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAddressAsString
/**
* 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);
}
示例2: getAddressAsHtml
/**
* 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;
}
示例3: getAddressAsString
/**
* 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);
}
示例4: getBillingAddressHtml
/**
* @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));
}
示例5: getAddressAsHtml
/**
* 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;
}
示例6: getBillingAddressHtml
/**
* 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));
}
示例7: format
/**
* 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));
}
示例8: testGetFormatTypeRenderer
/**
* @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));
}
示例9: format
/**
* 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));
}