public function ContentHubExportQueueForm::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_publisher/ src/ Form/ ContentHubExportQueueForm.php, line 93
Class
- ContentHubExportQueueForm
- Implements a form to Process items from the Content Hub Export Queue.
Namespace
Drupal\acquia_contenthub_publisher\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$queue_count = intval($this->contentHubExportQueue
->getQueueCount());
$trigger = $form_state
->getTriggeringElement();
switch ($trigger['#name']) {
case 'run_export_queue':
if (!empty($queue_count)) {
$this->contentHubExportQueue
->processQueueItems();
}
else {
$this
->messenger()
->addWarning($this
->t('You cannot run the export queue because it is empty.'));
}
break;
case 'purge_export_queue':
$this->contentHubExportQueue
->purgeQueues();
$this
->messenger()
->addMessage($this
->t('Purged all contenthub export queues.'));
break;
default:
break;
}
}