You are here

public function PriceResolverInterface::resolve in Price 2.0.x

Resolves a price for the given purchasable entity.

Use $context->getData('field_name', 'price') to get the name of the field for which the price is being resolved (e.g "price").

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.

string $quantity: The quantity.

\Drupal\price\Context $context: The context.

Return value

\Drupal\price\Price|null A price value object, if resolved. Otherwise NULL, indicating that the next resolver in the chain should be called.

2 methods override PriceResolverInterface::resolve()
ChainPriceResolver::resolve in src/Resolver/ChainPriceResolver.php
Resolves a price for the given purchasable entity.
DefaultPriceResolver::resolve in src/Resolver/DefaultPriceResolver.php
Resolves a price for the given purchasable entity.

File

src/Resolver/PriceResolverInterface.php, line 30

Class

PriceResolverInterface
Defines the interface for price resolvers.

Namespace

Drupal\price\Resolver

Code

public function resolve(ContentEntityInterface $entity, $quantity, Context $context);