You are here

interface PriceResolverInterface in Price 2.0.x

Defines the interface for price resolvers.

Hierarchy

Expanded class hierarchy of PriceResolverInterface

All classes that implement PriceResolverInterface

File

src/Resolver/PriceResolverInterface.php, line 11

Namespace

Drupal\price\Resolver
View 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 "price").
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface $entity
   *   The entity.
   * @param string $quantity
   *   The quantity.
   * @param \Drupal\price\Context $context
   *   The context.
   *
   * @return \Drupal\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(ContentEntityInterface $entity, $quantity, Context $context);

}

Members

Namesort descending Modifiers Type Description Overrides
PriceResolverInterface::resolve public function Resolves a price for the given purchasable entity. 2