public function ContentHubImportQueueForm::submitForm in Acquia Content Hub 8.2
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
- modules/
acquia_contenthub_subscriber/ src/ Form/ ContentHubImportQueueForm.php, line 136
Class
- ContentHubImportQueueForm
- The form for content hub import queues.
Namespace
Drupal\acquia_contenthub_subscriber\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$queue_count = intval($this->contentHubImportQueue
->getQueueCount());
$trigger = $form_state
->getTriggeringElement();
$messenger = $this
->messenger();
switch ($trigger['#name']) {
case 'queue_from_filters':
$filter_uuids = $this
->getFilterUuids();
if (!$filter_uuids) {
$messenger
->addMessage('No filters found!', 'warning');
break;
}
$this->importByFilter
->process($filter_uuids);
$messenger
->addMessage('Entities got queued for import.', 'status');
break;
case 'run_import_queue':
if (!empty($queue_count)) {
$this->contentHubImportQueue
->process();
}
else {
$messenger
->addMessage('You cannot run the import queue because it is empty.', 'warning');
}
break;
}
}