You are here

public function OrderCommentsPane::process in Ubercart 8.4

Processes a checkout pane.

Parameters

\Drupal\uc_order\OrderInterface $order: The order that is being processed.

array $form: The checkout form array.

\Drupal\Core\Form\FormStateInterface $form_state: The checkout form state array.

Return value

bool TRUE if the pane is valid, FALSE otherwise.

Overrides CheckoutPanePluginBase::process

File

uc_cart/src/Plugin/Ubercart/CheckoutPane/OrderCommentsPane.php, line 44

Class

OrderCommentsPane
Allows a customer to make comments on the order.

Namespace

Drupal\uc_cart\Plugin\Ubercart\CheckoutPane

Code

public function process(OrderInterface $order, array $form, FormStateInterface $form_state) {
  \Drupal::database()
    ->delete('uc_order_comments')
    ->condition('order_id', $order
    ->id())
    ->execute();
  if (!$form_state
    ->isValueEmpty([
    'panes',
    'comments',
    'comments',
  ])) {
    uc_order_comment_save($order
      ->id(), 0, $form_state
      ->getValue([
      'panes',
      'comments',
      'comments',
    ]), 'order', uc_order_state_default('post_checkout'), TRUE);
  }
  return TRUE;
}