interface PriceResolverInterface in Commerce Core 8.2
Defines the interface for price resolvers.
Hierarchy
- interface \Drupal\commerce_price\Resolver\PriceResolverInterface
Expanded class hierarchy of PriceResolverInterface
All classes that implement PriceResolverInterface
1 file declares its use of PriceResolverInterface
- TestPriceResolver.php in modules/
price/ tests/ modules/ commerce_price_test/ src/ TestPriceResolver.php
File
- modules/
price/ src/ Resolver/ PriceResolverInterface.php, line 11
Namespace
Drupal\commerce_price\ResolverView source
interface PriceResolverInterface {
/**
* 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 "list_price", "price").
*
* @param \Drupal\commerce\PurchasableEntityInterface $entity
* The purchasable entity.
* @param string $quantity
* The quantity.
* @param \Drupal\commerce\Context $context
* The context.
*
* @return \Drupal\commerce_price\Price|null
* A price value object, if resolved. Otherwise NULL, indicating that the
* next resolver in the chain should be called.
*/
public function resolve(PurchasableEntityInterface $entity, $quantity, Context $context);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PriceResolverInterface:: |
public | function | Resolves a price for the given purchasable entity. | 3 |