public function AddToCartForm::getFormId in Commerce Core 8.2
Returns a unique string identifying the form.
The returned ID should be a unique string that can be a valid PHP function name, since it's used in hook implementation names such as hook_form_FORM_ID_alter().
Return value
string The unique string identifying the form.
Overrides EntityForm::getFormId
File
- modules/
cart/ src/ Form/ AddToCartForm.php, line 145
Class
- AddToCartForm
- Provides the order item add to cart form.
Namespace
Drupal\commerce_cart\FormCode
public function getFormId() {
if (empty($this->formId)) {
$this->formId = $this
->getBaseFormId();
/** @var \Drupal\commerce_order\Entity\OrderItemInterface $order_item */
$order_item = $this->entity;
if ($purchased_entity = $order_item
->getPurchasedEntity()) {
$this->formId .= '_' . $purchased_entity
->getEntityTypeId() . '_' . $purchased_entity
->id();
}
}
return $this->formId;
}