You are here

interface AddToCartFormInterface in Commerce Core 8.2

Provides the add to cart form interface.

Extends the regular interface to allow the form ID to be overriden. By default the form ID is suffixed with the order item's purchasable entity ID, to achieve uniqueness. Callers can replace that form ID with a more stable one, or to handle the case where the order item has no purchasable entity, but multiple form instances are still desired.

Hierarchy

Expanded class hierarchy of AddToCartFormInterface

All classes that implement AddToCartFormInterface

File

modules/cart/src/Form/AddToCartFormInterface.php, line 16

Namespace

Drupal\commerce_cart\Form
View source
interface AddToCartFormInterface extends ContentEntityFormInterface {

  /**
   * Sets the form ID.
   *
   * @param string $form_id
   *   The form ID.
   *
   * @return $this
   */
  public function setFormId($form_id);

}

Members

Namesort descending Modifiers Type Description Overrides
AddToCartFormInterface::setFormId public function Sets the form ID. 1
BaseFormIdInterface::getBaseFormId public function Returns a string identifying the base form. 5
ContentEntityFormInterface::getFormDisplay public function Gets the form display. 1
ContentEntityFormInterface::getFormLangcode public function Gets the code identifying the active form language. 1
ContentEntityFormInterface::isDefaultFormLangcode public function Checks whether the current form language matches the entity one. 1
ContentEntityFormInterface::setFormDisplay public function Sets the form display. 1
ContentEntityFormInterface::validateForm public function Note that extending classes should not override this method to add entity validation logic, but define further validation constraints using the entity validation API and/or provide a new validation constraint if necessary. This is the only way to… Overrides FormInterface::validateForm
EntityFormInterface::buildEntity public function Builds an updated entity object based upon the submitted form values. 1
EntityFormInterface::getEntity public function Gets the form entity. 1
EntityFormInterface::getEntityFromRouteMatch public function Determines which entity will be used by this form from a RouteMatch object. 1
EntityFormInterface::getOperation public function Gets the operation identifying the form. 1
EntityFormInterface::save public function Form submission handler for the 'save' action. 1
EntityFormInterface::setEntity public function Sets the form entity. 1
EntityFormInterface::setEntityManager Deprecated public function Sets the entity manager for this form. 1
EntityFormInterface::setEntityTypeManager public function Sets the entity type manager for this form. 1
EntityFormInterface::setModuleHandler public function Sets the module handler for this form. 1
EntityFormInterface::setOperation public function Sets the operation for this form. 1
EntityFormInterface::setStringTranslation public function Sets the string translation service for this form.
FormInterface::buildForm public function Form constructor. 179
FormInterface::getFormId public function Returns a unique string identifying the form. 236
FormInterface::submitForm public function Form submission handler. 192