PHP Class Sonata\CustomerBundle\Twig\Extension\AddressExtension

Author: Hugo Briand ([email protected])
Inheritance: extends Twig_Extension
Mostra file Open project: sonata-project/ecommerce Class Usage Examples

Protected Properties

Property Type Description
$deliverySelector Sonata\Component\Delivery\ServiceDeliverySelectorInterface

Public Methods

Method Description
__construct ( Sonata\Component\Delivery\ServiceDeliverySelectorInterface $deliverySelector ) Constructor.
getFunctions ( )
getName ( )
isAddressDeliverable ( Sonata\Component\Customer\AddressInterface $address, Sonata\Component\Basket\BasketInterface $basket ) : boolean Returns if address can deliver the given basket.
renderAddress ( Twig_Environment $environment, mixed $address, boolean $showName = true, boolean $showEdit = false, string $context = null ) : string Gets the HTML of an address.

Method Details

__construct() public method

Constructor.
public __construct ( Sonata\Component\Delivery\ServiceDeliverySelectorInterface $deliverySelector )
$deliverySelector Sonata\Component\Delivery\ServiceDeliverySelectorInterface

getFunctions() public method

public getFunctions ( )

getName() public method

public getName ( )

isAddressDeliverable() public method

Returns if address can deliver the given basket.
public isAddressDeliverable ( Sonata\Component\Customer\AddressInterface $address, Sonata\Component\Basket\BasketInterface $basket ) : boolean
$address Sonata\Component\Customer\AddressInterface A Sonata e-commerce address instance
$basket Sonata\Component\Basket\BasketInterface A Sonata e-commerce basket instance
return boolean

renderAddress() public method

Gets the HTML of an address.
public renderAddress ( Twig_Environment $environment, mixed $address, boolean $showName = true, boolean $showEdit = false, string $context = null ) : string
$environment Twig_Environment A Twig environment
$address mixed An instance of AddressInterface or array with keys: (id, firstname, lastname, address1, postcode, city, country_code and optionally name, address2, address3)
$showName boolean Display address name?
$showEdit boolean Display edit button?
$context string A context for edit link
return string

Property Details

$deliverySelector protected_oe property

protected ServiceDeliverySelectorInterface,Sonata\Component\Delivery $deliverySelector
return Sonata\Component\Delivery\ServiceDeliverySelectorInterface