You are here

public function AdminComments::submitForm in Ubercart 8.4

Form submission handler.

Parameters

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

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides EditableOrderPanePluginInterface::submitForm

File

uc_order/src/Plugin/Ubercart/OrderPane/AdminComments.php, line 89

Class

AdminComments
View the admin comments, used for administrative notes and instructions.

Namespace

Drupal\uc_order\Plugin\Ubercart\OrderPane

Code

public function submitForm(OrderInterface $order, array &$form, FormStateInterface $form_state) {
  if (!$form_state
    ->isValueEmpty('admin_comment')) {
    $uid = \Drupal::currentUser()
      ->id();
    uc_order_comment_save($order
      ->id(), $uid, $form_state
      ->getValue('admin_comment'));
  }
}