You are here

public function LibraryCheckOutBulkForm::submitForm in Library 8

Form submission handler.

Parameters

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

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

Overrides FormInterface::submitForm

File

src/Form/LibraryCheckOutBulkForm.php, line 114

Class

LibraryCheckOutBulkForm
Bulk checkout form.

Namespace

Drupal\library\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) : void {
  $data = $form_state
    ->getValues();
  foreach ($data as $key => $item) {
    if (strpos($key, 'item_') !== FALSE && !empty($item)) {
      $libraryItem = LibraryItemHelper::findByBarcode($item);
      if ($libraryItem) {
        $this
          ->processTransaction($libraryItem, $data);
      }
    }
  }
}