You are here

public static function CombinationOffer::removeOfferSubmit in Commerce Core 8.2

Submit callback for removing an offer.

File

modules/promotion/src/Plugin/Commerce/PromotionOffer/CombinationOffer.php, line 226

Class

CombinationOffer
Provides the 'combination_offer' offer plugin.

Namespace

Drupal\commerce_promotion\Plugin\Commerce\PromotionOffer

Code

public static function removeOfferSubmit(array $form, FormStateInterface $form_state) {
  $offers = $form_state
    ->get('offers');
  $index = $form_state
    ->getTriggeringElement()['#offer_index'];
  unset($offers[$index]);
  $form_state
    ->set('offers', $offers);
  $form_state
    ->setRebuild();
}