From bae81d19678e7f156683637de3e90fc1d99ffd94 Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Fri, 3 Nov 2023 18:21:23 +1100 Subject: [PATCH] Added warning if queue factory is not set. --- quant.module | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/quant.module b/quant.module index 7beea3fc..5feecaab 100644 --- a/quant.module +++ b/quant.module @@ -6,15 +6,28 @@ */ use Drupal\Core\Access\AccessResult; -use Drupal\Core\Session\AccountInterface; -use Drupal\node\NodeInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Session\AccountInterface; +use Drupal\Core\Site\Settings; use Drupal\Core\Url; +use Drupal\node\NodeInterface; use Drupal\quant\Exception\TokenValidationDisabledException; use Drupal\quant\Plugin\QueueItem\RouteItem; -use Drupal\quant\Seed; use Drupal\quant\QuantQueueFactory; +use Drupal\quant\Seed; + +/** + * Implements hook_preprocess_page(). + */ +function quant_preprocess_page(&$variables) { + + // Add warning on Quant admin pages if queue factory is not set. + $current_path = \Drupal::requestStack()->getCurrentRequest()->getPathInfo(); + if ((strpos($current_path, '/admin/config/quant') === 0) && Settings::get('queue_service_quant_seed_worker') != "quant.queue_factory") { + \Drupal::messenger()->addWarning(t("For the best performance, it is highly recommended you update queue_service_quant_seed_worker in your settings. See the Drupal docs for setup information.")); + } +} /** * Implements hook_menu_local_tasks_alter().