public function RemoveButton::viewsFormSubmit in Commerce Wishlist 8.3
Submit handler for the views form.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- src/
Plugin/ views/ field/ RemoveButton.php, line 110
Class
- RemoveButton
- Defines a form element for removing the wishlist item.
Namespace
Drupal\commerce_wishlist\Plugin\views\fieldCode
public function viewsFormSubmit(array &$form, FormStateInterface $form_state) {
$triggering_element = $form_state
->getTriggeringElement();
if (!empty($triggering_element['#remove_wishlist_item'])) {
$row_index = $triggering_element['#row_index'];
/** @var \Drupal\commerce_wishlist\Entity\WishlistItemInterface $wishlist_item */
$wishlist_item = $this
->getEntity($this->view->result[$row_index]);
$this->wishlistManager
->removeWishlistItem($wishlist_item
->getWishlist(), $wishlist_item);
}
}