Esempio n. 1
0
 /**
  * Submit handler for the views form.
  *
  * @param array $form
  *   An associative array containing the structure of the form.
  * @param \Drupal\Core\Form\FormStateInterface $form_state
  *   The current state of the form.
  */
 public function viewsFormSubmit(&$form, FormStateInterface $form_state)
 {
     $quantities = $form_state->getValue($this->options['id']);
     foreach ($quantities as $row_index => $quantity) {
         $line_item = $this->getEntity($this->view->result[$row_index]);
         if ($line_item->getQuantity() != $quantity) {
             $line_item->setQuantity($quantity);
             $order = $line_item->getOrder();
             $this->cartManager->updateLineItem($order, $line_item);
         }
     }
 }