From b3fb7ac7400c675a880bf644e701573a8aa81686 Mon Sep 17 00:00:00 2001 From: Project-Update-bot Date: Tue, 18 Jun 2024 03:16:39 +0000 Subject: [PATCH 01/20] Automated Project Update Bot fixes from run 11-199781. --- .../quant_api/src/EventSubscriber/QuantApi.php | 2 +- .../tests/src/Unit/QuantClientTest.php | 9 +++------ .../src/StackMiddleware/UrlRegistrar.php | 2 +- .../EventSubscriber/SearchEventSubscriber.php | 2 +- .../EventSubscriber/CollectionSubscriber.php | 2 +- .../tests/src/Unit/SitemapManagerTest.php | 18 ++++-------------- .../src/EventSubscriber/RedirectSubscriber.php | 2 +- src/EventSubscriber/CollectionSubscriber.php | 2 +- src/EventSubscriber/NodeInsertSubscriber.php | 2 +- src/EventSubscriber/TokenAccessSubscriber.php | 2 +- 10 files changed, 15 insertions(+), 28 deletions(-) diff --git a/modules/quant_api/src/EventSubscriber/QuantApi.php b/modules/quant_api/src/EventSubscriber/QuantApi.php index 750fd424..93700d7b 100644 --- a/modules/quant_api/src/EventSubscriber/QuantApi.php +++ b/modules/quant_api/src/EventSubscriber/QuantApi.php @@ -64,7 +64,7 @@ public function __construct(QuantClientInterface $client, LoggerChannelFactoryIn /** * {@inheritdoc} */ - public static function getSubscribedEvents() { + public static function getSubscribedEvents(): array { $events[QuantEvent::OUTPUT] = ['onOutput', -999]; $events[QuantFileEvent::OUTPUT] = ['onMedia', -999]; $events[QuantRedirectEvent::UPDATE] = ['onRedirect', -999]; diff --git a/modules/quant_api/tests/src/Unit/QuantClientTest.php b/modules/quant_api/tests/src/Unit/QuantClientTest.php index 871ade1b..31dd205a 100644 --- a/modules/quant_api/tests/src/Unit/QuantClientTest.php +++ b/modules/quant_api/tests/src/Unit/QuantClientTest.php @@ -199,10 +199,9 @@ public function testSendValid() { /** * Ensure that send handles server errors. - * - * @expectedException GuzzleHttp\Exception\RequestException */ public function testSendError() { + $this->expectException(\GuzzleHttp\Exception\RequestException::class); $http = $this->prophesize(Client::class); $logger = $this->prophesize(LoggerChannelFactoryInterface::class); $config = $this->getConfigStub(); @@ -254,10 +253,9 @@ public function testSendRedirectValid() { /** * Ensure a valid redirect response is sent. - * - * @expectedException GuzzleHttp\Exception\RequestException */ public function testSendRedirectError() { + $this->expectException(\GuzzleHttp\Exception\RequestException::class); $http = $this->prophesize(Client::class); $logger = $this->prophesize(LoggerChannelFactoryInterface::class); $config = $this->getConfigStub(); @@ -278,10 +276,9 @@ public function testSendRedirectError() { /** * Ensure files are validated before sending. - * - * @expectedException Drupal\quant_api\Exception\InvalidPayload */ public function testSendFileFileNoExist() { + $this->expectException(\Drupal\quant_api\Exception\InvalidPayload::class); // phpcs:ignore global $exists_return; // phpcs:ignore diff --git a/modules/quant_purger/src/StackMiddleware/UrlRegistrar.php b/modules/quant_purger/src/StackMiddleware/UrlRegistrar.php index 1b186e1d..019c2bd8 100644 --- a/modules/quant_purger/src/StackMiddleware/UrlRegistrar.php +++ b/modules/quant_purger/src/StackMiddleware/UrlRegistrar.php @@ -57,7 +57,7 @@ public function __construct(HttpKernelInterface $http_kernel, TrafficRegistryInt /** * {@inheritdoc} */ - public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) { + public function handle(Request $request, $type = self::MAIN_REQUEST, $catch = TRUE) { $response = $this->httpKernel->handle($request, $type, $catch); if ($this->determine($request, $response)) { $this->registry->add( diff --git a/modules/quant_search/src/EventSubscriber/SearchEventSubscriber.php b/modules/quant_search/src/EventSubscriber/SearchEventSubscriber.php index 9272f30e..2011171c 100644 --- a/modules/quant_search/src/EventSubscriber/SearchEventSubscriber.php +++ b/modules/quant_search/src/EventSubscriber/SearchEventSubscriber.php @@ -45,7 +45,7 @@ public function __construct(LoggerChannelFactoryInterface $logger_factory, Conta /** * {@inheritdoc} */ - public static function getSubscribedEvents() { + public static function getSubscribedEvents(): array { $events[QuantEvent::OUTPUT] = ['onOutput', 1]; return $events; } diff --git a/modules/quant_sitemap/src/EventSubscriber/CollectionSubscriber.php b/modules/quant_sitemap/src/EventSubscriber/CollectionSubscriber.php index 74334676..197cec31 100644 --- a/modules/quant_sitemap/src/EventSubscriber/CollectionSubscriber.php +++ b/modules/quant_sitemap/src/EventSubscriber/CollectionSubscriber.php @@ -37,7 +37,7 @@ public function __construct(SitemapManager $manager) { /** * {@inheritdoc} */ - public static function getSubscribedEvents() { + public static function getSubscribedEvents(): array { $events[QuantCollectionEvents::ROUTES][] = ['collectRoutes']; return $events; } diff --git a/modules/quant_sitemap/tests/src/Unit/SitemapManagerTest.php b/modules/quant_sitemap/tests/src/Unit/SitemapManagerTest.php index 9324a973..7c6035b3 100644 --- a/modules/quant_sitemap/tests/src/Unit/SitemapManagerTest.php +++ b/modules/quant_sitemap/tests/src/Unit/SitemapManagerTest.php @@ -37,9 +37,7 @@ public function testSimpleSitemapSupportedVersion() { ->with('simple_sitemap') ->willReturn($module); - $entity_manager_mock = $this->getMockBuilder(EntityTypeManager::class) - ->disableOriginalConstructor() - ->getMock(); + $entity_manager_mock = $this->createMock(EntityTypeManager::class); $manager = new SitemapManager($module_handler_mock, $entity_manager_mock, $module_list_mock); $result = $manager->isAvailable(); @@ -67,9 +65,7 @@ public function testSimpleSitemapUnsupportedVersion() { ->with('simple_sitemap') ->willReturn($module); - $entity_manager_mock = $this->getMockBuilder(EntityTypeManager::class) - ->disableOriginalConstructor() - ->getMock(); + $entity_manager_mock = $this->createMock(EntityTypeManager::class); $manager = new SitemapManager($module_handler_mock, $entity_manager_mock, $module_list_mock); $result = $manager->isAvailable(); @@ -97,9 +93,7 @@ public function testXmlsitemapSupportedVersion() { ->with('xmlsitemap') ->willReturn($module); - $entity_manager_mock = $this->getMockBuilder(EntityTypeManager::class) - ->disableOriginalConstructor() - ->getMock(); + $entity_manager_mock = $this->createMock(EntityTypeManager::class); $manager = new SitemapManager($module_handler_mock, $entity_manager_mock, $module_list_mock); $result = $manager->isAvailable(); @@ -127,9 +121,7 @@ public function testXmlsitemapUnsupportedVersion() { ->with('xmlsitemap') ->willReturn($module); - $entity_manager_mock = $this->getMockBuilder(EntityTypeManager::class) - ->disableOriginalConstructor() - ->getMock(); + $entity_manager_mock = $this->createMock(EntityTypeManager::class); $manager = new SitemapManager($module_handler_mock, $entity_manager_mock, $module_list_mock); $result = $manager->isAvailable(); @@ -157,7 +149,6 @@ public function testSitemapUnavailable() { $entity_manager_mock, $module_list_mock, ]) - ->setMethods(['isAvailable']) ->getMock(); $manager->expects($this->once()) @@ -197,7 +188,6 @@ public function testSimpleSitemapListItems() { $entity_manager_mock, $module_list_mock, ]) - ->setMethods(['isAvailable', 'getSitemapManager']) ->getMock(); $manager->expects($this->once()) diff --git a/modules/quant_tome/src/EventSubscriber/RedirectSubscriber.php b/modules/quant_tome/src/EventSubscriber/RedirectSubscriber.php index 9891961f..ea52a731 100644 --- a/modules/quant_tome/src/EventSubscriber/RedirectSubscriber.php +++ b/modules/quant_tome/src/EventSubscriber/RedirectSubscriber.php @@ -60,7 +60,7 @@ public function onResponse(ResponseEvent $event) { /** * {@inheritdoc} */ - public static function getSubscribedEvents() { + public static function getSubscribedEvents(): array { $events[KernelEvents::RESPONSE][] = ['onResponse']; return $events; } diff --git a/src/EventSubscriber/CollectionSubscriber.php b/src/EventSubscriber/CollectionSubscriber.php index f304014c..707a2967 100644 --- a/src/EventSubscriber/CollectionSubscriber.php +++ b/src/EventSubscriber/CollectionSubscriber.php @@ -48,7 +48,7 @@ public function __construct(EntityTypeManager $entity_type_manager, ConfigFactor /** * {@inheritdoc} */ - public static function getSubscribedEvents() { + public static function getSubscribedEvents(): array { $events[QuantCollectionEvents::ENTITIES][] = ['collectEntities']; $events[QuantCollectionEvents::TAXONOMY_TERMS][] = ['collectTaxonomyTerms']; $events[QuantCollectionEvents::FILES][] = ['collectFiles']; diff --git a/src/EventSubscriber/NodeInsertSubscriber.php b/src/EventSubscriber/NodeInsertSubscriber.php index ddea1c2e..c46178f1 100644 --- a/src/EventSubscriber/NodeInsertSubscriber.php +++ b/src/EventSubscriber/NodeInsertSubscriber.php @@ -45,7 +45,7 @@ public function onNodeInsert(NodeInsertEvent $event) { /** * {@inheritdoc} */ - public static function getSubscribedEvents() { + public static function getSubscribedEvents(): array { $events[NodeInsertEvent::NODE_INSERT_EVENT][] = ['onNodeInsert']; return $events; } diff --git a/src/EventSubscriber/TokenAccessSubscriber.php b/src/EventSubscriber/TokenAccessSubscriber.php index 87b7f768..95215619 100644 --- a/src/EventSubscriber/TokenAccessSubscriber.php +++ b/src/EventSubscriber/TokenAccessSubscriber.php @@ -43,7 +43,7 @@ public function __construct(TokenManager $token_manager, ConfigFactoryInterface /** * {@inheritdoc} */ - public static function getSubscribedEvents() { + public static function getSubscribedEvents(): array { $events[KernelEvents::REQUEST][] = ['validateToken']; return $events; } From 1152997af1586b40eaa218c51a107935defb2aaa Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Thu, 21 Nov 2024 17:03:48 -0800 Subject: [PATCH 02/20] Revert mock changes and use onlyMethods. --- .../tests/src/Unit/SitemapManagerTest.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/quant_sitemap/tests/src/Unit/SitemapManagerTest.php b/modules/quant_sitemap/tests/src/Unit/SitemapManagerTest.php index 7c6035b3..28e52704 100644 --- a/modules/quant_sitemap/tests/src/Unit/SitemapManagerTest.php +++ b/modules/quant_sitemap/tests/src/Unit/SitemapManagerTest.php @@ -37,7 +37,9 @@ public function testSimpleSitemapSupportedVersion() { ->with('simple_sitemap') ->willReturn($module); - $entity_manager_mock = $this->createMock(EntityTypeManager::class); + $entity_manager_mock = $this->getMockBuilder(EntityTypeManager::class) + ->disableOriginalConstructor() + ->getMock(); $manager = new SitemapManager($module_handler_mock, $entity_manager_mock, $module_list_mock); $result = $manager->isAvailable(); @@ -65,7 +67,9 @@ public function testSimpleSitemapUnsupportedVersion() { ->with('simple_sitemap') ->willReturn($module); - $entity_manager_mock = $this->createMock(EntityTypeManager::class); + $entity_manager_mock = $this->getMockBuilder(EntityTypeManager::class) + ->disableOriginalConstructor() + ->getMock(); $manager = new SitemapManager($module_handler_mock, $entity_manager_mock, $module_list_mock); $result = $manager->isAvailable(); @@ -93,7 +97,9 @@ public function testXmlsitemapSupportedVersion() { ->with('xmlsitemap') ->willReturn($module); - $entity_manager_mock = $this->createMock(EntityTypeManager::class); + $entity_manager_mock = $this->getMockBuilder(EntityTypeManager::class) + ->disableOriginalConstructor() + ->getMock(); $manager = new SitemapManager($module_handler_mock, $entity_manager_mock, $module_list_mock); $result = $manager->isAvailable(); @@ -121,7 +127,9 @@ public function testXmlsitemapUnsupportedVersion() { ->with('xmlsitemap') ->willReturn($module); - $entity_manager_mock = $this->createMock(EntityTypeManager::class); + $entity_manager_mock = $this->getMockBuilder(EntityTypeManager::class) + ->disableOriginalConstructor() + ->getMock(); $manager = new SitemapManager($module_handler_mock, $entity_manager_mock, $module_list_mock); $result = $manager->isAvailable(); @@ -149,6 +157,7 @@ public function testSitemapUnavailable() { $entity_manager_mock, $module_list_mock, ]) + ->onlyMethods(['isAvailable']) ->getMock(); $manager->expects($this->once()) @@ -188,6 +197,7 @@ public function testSimpleSitemapListItems() { $entity_manager_mock, $module_list_mock, ]) + ->onlyMethods(['isAvailable', 'getSitemapManager']) ->getMock(); $manager->expects($this->once()) From 733c472a0c974781454f65a6bbb257f756e0f855 Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Thu, 21 Nov 2024 17:09:46 -0800 Subject: [PATCH 03/20] Bump version to 10 and 11 and drop 9. --- modules/quant_api/quant_api.info.yml | 2 +- modules/quant_cron/quant_cron.info.yml | 2 +- modules/quant_purger/quant_purger.info.yml | 2 +- modules/quant_search/quant_search.info.yml | 2 +- modules/quant_sitemap/quant_sitemap.info.yml | 2 +- modules/quant_tome/quant_tome.info.yml | 2 +- modules/quant_webform/quant_webform.info.yml | 2 +- quant.info.yml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/quant_api/quant_api.info.yml b/modules/quant_api/quant_api.info.yml index 4e8d0b8f..0238e867 100644 --- a/modules/quant_api/quant_api.info.yml +++ b/modules/quant_api/quant_api.info.yml @@ -3,7 +3,7 @@ description: Connect to the hosted Quant service package: Quant type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^10 || ^11 configure: quant_api.settings_form dependencies: - drupal:quant diff --git a/modules/quant_cron/quant_cron.info.yml b/modules/quant_cron/quant_cron.info.yml index 61fe1670..0d73716f 100644 --- a/modules/quant_cron/quant_cron.info.yml +++ b/modules/quant_cron/quant_cron.info.yml @@ -3,7 +3,7 @@ description: Run Quant tasks during cron package: Quant type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^10 || ^11 configure: quant_cron.settings_form dependencies: - quant:quant_api diff --git a/modules/quant_purger/quant_purger.info.yml b/modules/quant_purger/quant_purger.info.yml index 5c819d3c..4aedf589 100644 --- a/modules/quant_purger/quant_purger.info.yml +++ b/modules/quant_purger/quant_purger.info.yml @@ -3,7 +3,7 @@ description: Cache tag purger for Quant. package: Quant type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^10 || ^11 dependencies: - quant:quant diff --git a/modules/quant_search/quant_search.info.yml b/modules/quant_search/quant_search.info.yml index 9baa8515..8a4cd6ba 100644 --- a/modules/quant_search/quant_search.info.yml +++ b/modules/quant_search/quant_search.info.yml @@ -3,7 +3,7 @@ description: 'Allows creation of Quant Search pages.' package: Quant type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^10 || ^11 configure: quant_search.main dependencies: - drupal:quant diff --git a/modules/quant_sitemap/quant_sitemap.info.yml b/modules/quant_sitemap/quant_sitemap.info.yml index 824fb56b..7eab6007 100644 --- a/modules/quant_sitemap/quant_sitemap.info.yml +++ b/modules/quant_sitemap/quant_sitemap.info.yml @@ -3,7 +3,7 @@ description: Quant simple_sitemap support package: Quant type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^10 || ^11 dependencies: - quant:quant_api diff --git a/modules/quant_tome/quant_tome.info.yml b/modules/quant_tome/quant_tome.info.yml index 34a285ac..dc733996 100644 --- a/modules/quant_tome/quant_tome.info.yml +++ b/modules/quant_tome/quant_tome.info.yml @@ -3,7 +3,7 @@ description: 'Deploy Tome static output to Quant.' package: Quant type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^10 || ^11 dependencies: - tome:tome_static diff --git a/modules/quant_webform/quant_webform.info.yml b/modules/quant_webform/quant_webform.info.yml index 64b4b768..75bc55b3 100644 --- a/modules/quant_webform/quant_webform.info.yml +++ b/modules/quant_webform/quant_webform.info.yml @@ -3,7 +3,7 @@ description: Quant Form support for Webform package: Quant type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^10 || ^11 dependencies: - quant:quant diff --git a/quant.info.yml b/quant.info.yml index 9ed0863e..a2aac12e 100644 --- a/quant.info.yml +++ b/quant.info.yml @@ -3,7 +3,7 @@ description: Quant content export package: Quant type: module -core_version_requirement: ^9.3 || ^10 +core_version_requirement: ^10 || ^11 configure: quant.config dependencies: - drupal:taxonomy From 68736194b7326d19cda253d5c0a1a61788f06227 Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Thu, 21 Nov 2024 17:30:18 -0800 Subject: [PATCH 04/20] Remove ContainerAwareEventDispatcher deprecation. --- modules/quant_api/src/EventSubscriber/QuantApi.php | 8 ++++---- .../src/EventSubscriber/SearchEventSubscriber.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/quant_api/src/EventSubscriber/QuantApi.php b/modules/quant_api/src/EventSubscriber/QuantApi.php index 93700d7b..38aca53b 100644 --- a/modules/quant_api/src/EventSubscriber/QuantApi.php +++ b/modules/quant_api/src/EventSubscriber/QuantApi.php @@ -2,7 +2,6 @@ namespace Drupal\quant_api\EventSubscriber; -use Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher; use Drupal\Core\Logger\LoggerChannelFactoryInterface; use Drupal\quant\Event\QuantEvent; use Drupal\quant\Event\QuantFileEvent; @@ -14,6 +13,7 @@ use Drupal\quant\Utility; use Drupal\quant_api\Client\QuantClientInterface; use Drupal\quant_api\Exception\InvalidPayload; +use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -38,7 +38,7 @@ class QuantApi implements EventSubscriberInterface { /** * The event dispatcher. * - * @var \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher + * @var \Symfony\Component\EventDispatcher\EventDispatcher */ protected $eventDispatcher; @@ -52,10 +52,10 @@ class QuantApi implements EventSubscriberInterface { * The Drupal HTTP Client to make requests. * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory * The logger channel factory. - * @param \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher $event_dispatcher + * @param \Symfony\Component\EventDispatcher\EventDispatcher $event_dispatcher * The event dispatcher. */ - public function __construct(QuantClientInterface $client, LoggerChannelFactoryInterface $logger_factory, ContainerAwareEventDispatcher $event_dispatcher) { + public function __construct(QuantClientInterface $client, LoggerChannelFactoryInterface $logger_factory, EventDispatcher $event_dispatcher) { $this->client = $client; $this->logger = $logger_factory->get('quant_api'); $this->eventDispatcher = $event_dispatcher; diff --git a/modules/quant_search/src/EventSubscriber/SearchEventSubscriber.php b/modules/quant_search/src/EventSubscriber/SearchEventSubscriber.php index 2011171c..0449cef9 100644 --- a/modules/quant_search/src/EventSubscriber/SearchEventSubscriber.php +++ b/modules/quant_search/src/EventSubscriber/SearchEventSubscriber.php @@ -2,10 +2,10 @@ namespace Drupal\quant_search\EventSubscriber; -use Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher; use Drupal\Core\Logger\LoggerChannelFactoryInterface; use Drupal\quant\Event\QuantEvent; use Drupal\quant_search\Controller\Search; +use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -23,7 +23,7 @@ class SearchEventSubscriber implements EventSubscriberInterface { /** * The event dispatcher. * - * @var \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher + * @var \Symfony\Component\EventDispatcher\EventDispatcher */ protected $eventDispatcher; @@ -34,10 +34,10 @@ class SearchEventSubscriber implements EventSubscriberInterface { * * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory * The logger channel factory. - * @param \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher $event_dispatcher + * @param \Symfony\Component\EventDispatcher\EventDispatcher $event_dispatcher * The event dispatcher. */ - public function __construct(LoggerChannelFactoryInterface $logger_factory, ContainerAwareEventDispatcher $event_dispatcher) { + public function __construct(LoggerChannelFactoryInterface $logger_factory, EventDispatcher $event_dispatcher) { $this->logger = $logger_factory->get('quant_search'); $this->eventDispatcher = $event_dispatcher; } From 975f4498fedc279e95d15401fc37fee1ec2da498 Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Thu, 21 Nov 2024 17:36:25 -0800 Subject: [PATCH 05/20] Bumping to min 10.3 due to deprecations. --- modules/quant_api/quant_api.info.yml | 2 +- modules/quant_cron/quant_cron.info.yml | 2 +- modules/quant_purger/quant_purger.info.yml | 2 +- modules/quant_search/quant_search.info.yml | 2 +- modules/quant_sitemap/quant_sitemap.info.yml | 2 +- modules/quant_tome/quant_tome.info.yml | 2 +- modules/quant_webform/quant_webform.info.yml | 2 +- quant.info.yml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/quant_api/quant_api.info.yml b/modules/quant_api/quant_api.info.yml index 0238e867..7708eb04 100644 --- a/modules/quant_api/quant_api.info.yml +++ b/modules/quant_api/quant_api.info.yml @@ -3,7 +3,7 @@ description: Connect to the hosted Quant service package: Quant type: module -core_version_requirement: ^10 || ^11 +core_version_requirement: ^10.3 || ^11 configure: quant_api.settings_form dependencies: - drupal:quant diff --git a/modules/quant_cron/quant_cron.info.yml b/modules/quant_cron/quant_cron.info.yml index 0d73716f..60b743e6 100644 --- a/modules/quant_cron/quant_cron.info.yml +++ b/modules/quant_cron/quant_cron.info.yml @@ -3,7 +3,7 @@ description: Run Quant tasks during cron package: Quant type: module -core_version_requirement: ^10 || ^11 +core_version_requirement: ^10.3 || ^11 configure: quant_cron.settings_form dependencies: - quant:quant_api diff --git a/modules/quant_purger/quant_purger.info.yml b/modules/quant_purger/quant_purger.info.yml index 4aedf589..92c92787 100644 --- a/modules/quant_purger/quant_purger.info.yml +++ b/modules/quant_purger/quant_purger.info.yml @@ -3,7 +3,7 @@ description: Cache tag purger for Quant. package: Quant type: module -core_version_requirement: ^10 || ^11 +core_version_requirement: ^10.3 || ^11 dependencies: - quant:quant diff --git a/modules/quant_search/quant_search.info.yml b/modules/quant_search/quant_search.info.yml index 8a4cd6ba..63bec00f 100644 --- a/modules/quant_search/quant_search.info.yml +++ b/modules/quant_search/quant_search.info.yml @@ -3,7 +3,7 @@ description: 'Allows creation of Quant Search pages.' package: Quant type: module -core_version_requirement: ^10 || ^11 +core_version_requirement: ^10.3 || ^11 configure: quant_search.main dependencies: - drupal:quant diff --git a/modules/quant_sitemap/quant_sitemap.info.yml b/modules/quant_sitemap/quant_sitemap.info.yml index 7eab6007..4682ef6f 100644 --- a/modules/quant_sitemap/quant_sitemap.info.yml +++ b/modules/quant_sitemap/quant_sitemap.info.yml @@ -3,7 +3,7 @@ description: Quant simple_sitemap support package: Quant type: module -core_version_requirement: ^10 || ^11 +core_version_requirement: ^10.3 || ^11 dependencies: - quant:quant_api diff --git a/modules/quant_tome/quant_tome.info.yml b/modules/quant_tome/quant_tome.info.yml index dc733996..48e676ce 100644 --- a/modules/quant_tome/quant_tome.info.yml +++ b/modules/quant_tome/quant_tome.info.yml @@ -3,7 +3,7 @@ description: 'Deploy Tome static output to Quant.' package: Quant type: module -core_version_requirement: ^10 || ^11 +core_version_requirement: ^10.3 || ^11 dependencies: - tome:tome_static diff --git a/modules/quant_webform/quant_webform.info.yml b/modules/quant_webform/quant_webform.info.yml index 75bc55b3..b81fef5a 100644 --- a/modules/quant_webform/quant_webform.info.yml +++ b/modules/quant_webform/quant_webform.info.yml @@ -3,7 +3,7 @@ description: Quant Form support for Webform package: Quant type: module -core_version_requirement: ^10 || ^11 +core_version_requirement: ^10.3 || ^11 dependencies: - quant:quant diff --git a/quant.info.yml b/quant.info.yml index a2aac12e..817a638e 100644 --- a/quant.info.yml +++ b/quant.info.yml @@ -3,7 +3,7 @@ description: Quant content export package: Quant type: module -core_version_requirement: ^10 || ^11 +core_version_requirement: ^10.3 || ^11 configure: quant.config dependencies: - drupal:taxonomy From 7e0804a39e60a74e633b6a90fe946cf92429a5b8 Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Sun, 12 Jan 2025 15:16:23 -0800 Subject: [PATCH 06/20] Only support D11 for new branch. --- modules/quant_api/quant_api.info.yml | 2 +- modules/quant_cron/quant_cron.info.yml | 2 +- modules/quant_purger/quant_purger.info.yml | 2 +- modules/quant_search/quant_search.info.yml | 2 +- modules/quant_sitemap/quant_sitemap.info.yml | 2 +- modules/quant_tome/quant_tome.info.yml | 2 +- modules/quant_webform/quant_webform.info.yml | 2 +- quant.info.yml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/quant_api/quant_api.info.yml b/modules/quant_api/quant_api.info.yml index 7708eb04..0afdadb7 100644 --- a/modules/quant_api/quant_api.info.yml +++ b/modules/quant_api/quant_api.info.yml @@ -3,7 +3,7 @@ description: Connect to the hosted Quant service package: Quant type: module -core_version_requirement: ^10.3 || ^11 +core_version_requirement: ^11 configure: quant_api.settings_form dependencies: - drupal:quant diff --git a/modules/quant_cron/quant_cron.info.yml b/modules/quant_cron/quant_cron.info.yml index 60b743e6..0b8351c8 100644 --- a/modules/quant_cron/quant_cron.info.yml +++ b/modules/quant_cron/quant_cron.info.yml @@ -3,7 +3,7 @@ description: Run Quant tasks during cron package: Quant type: module -core_version_requirement: ^10.3 || ^11 +core_version_requirement: ^11 configure: quant_cron.settings_form dependencies: - quant:quant_api diff --git a/modules/quant_purger/quant_purger.info.yml b/modules/quant_purger/quant_purger.info.yml index 92c92787..b9155056 100644 --- a/modules/quant_purger/quant_purger.info.yml +++ b/modules/quant_purger/quant_purger.info.yml @@ -3,7 +3,7 @@ description: Cache tag purger for Quant. package: Quant type: module -core_version_requirement: ^10.3 || ^11 +core_version_requirement: ^11 dependencies: - quant:quant diff --git a/modules/quant_search/quant_search.info.yml b/modules/quant_search/quant_search.info.yml index 63bec00f..e6443325 100644 --- a/modules/quant_search/quant_search.info.yml +++ b/modules/quant_search/quant_search.info.yml @@ -3,7 +3,7 @@ description: 'Allows creation of Quant Search pages.' package: Quant type: module -core_version_requirement: ^10.3 || ^11 +core_version_requirement: ^11 configure: quant_search.main dependencies: - drupal:quant diff --git a/modules/quant_sitemap/quant_sitemap.info.yml b/modules/quant_sitemap/quant_sitemap.info.yml index 4682ef6f..0ffec204 100644 --- a/modules/quant_sitemap/quant_sitemap.info.yml +++ b/modules/quant_sitemap/quant_sitemap.info.yml @@ -3,7 +3,7 @@ description: Quant simple_sitemap support package: Quant type: module -core_version_requirement: ^10.3 || ^11 +core_version_requirement: ^11 dependencies: - quant:quant_api diff --git a/modules/quant_tome/quant_tome.info.yml b/modules/quant_tome/quant_tome.info.yml index 48e676ce..bccdb469 100644 --- a/modules/quant_tome/quant_tome.info.yml +++ b/modules/quant_tome/quant_tome.info.yml @@ -3,7 +3,7 @@ description: 'Deploy Tome static output to Quant.' package: Quant type: module -core_version_requirement: ^10.3 || ^11 +core_version_requirement: ^11 dependencies: - tome:tome_static diff --git a/modules/quant_webform/quant_webform.info.yml b/modules/quant_webform/quant_webform.info.yml index b81fef5a..239f34e1 100644 --- a/modules/quant_webform/quant_webform.info.yml +++ b/modules/quant_webform/quant_webform.info.yml @@ -3,7 +3,7 @@ description: Quant Form support for Webform package: Quant type: module -core_version_requirement: ^10.3 || ^11 +core_version_requirement: ^11 dependencies: - quant:quant diff --git a/quant.info.yml b/quant.info.yml index 817a638e..5516f080 100644 --- a/quant.info.yml +++ b/quant.info.yml @@ -3,7 +3,7 @@ description: Quant content export package: Quant type: module -core_version_requirement: ^10.3 || ^11 +core_version_requirement: ^11 configure: quant.config dependencies: - drupal:taxonomy From 45255a68fd8a645b26a508dab598a191c9702f2b Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Mon, 27 Jan 2025 19:03:51 -0800 Subject: [PATCH 07/20] Add "use" for classes. --- .../quant_api/tests/src/Unit/QuantClientTest.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/quant_api/tests/src/Unit/QuantClientTest.php b/modules/quant_api/tests/src/Unit/QuantClientTest.php index 31dd205a..184d50fb 100644 --- a/modules/quant_api/tests/src/Unit/QuantClientTest.php +++ b/modules/quant_api/tests/src/Unit/QuantClientTest.php @@ -2,12 +2,13 @@ namespace Drupal\Tests\quant_api\Unit; -use Drupal\Tests\UnitTestCase; -use Drupal\quant_api\Client\QuantClient; -use GuzzleHttp\Client; use Drupal\Core\Logger\LoggerChannelFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ImmutableConfig; +use Drupal\quant_api\Client\QuantClient; +use Drupal\quant_api\Exception\InvalidPayload; +use Drupal\Tests\UnitTestCase; +use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\Response; use GuzzleHttp\RequestOptions; @@ -201,7 +202,7 @@ public function testSendValid() { * Ensure that send handles server errors. */ public function testSendError() { - $this->expectException(\GuzzleHttp\Exception\RequestException::class); + $this->expectException(RequestException::class); $http = $this->prophesize(Client::class); $logger = $this->prophesize(LoggerChannelFactoryInterface::class); $config = $this->getConfigStub(); @@ -255,7 +256,7 @@ public function testSendRedirectValid() { * Ensure a valid redirect response is sent. */ public function testSendRedirectError() { - $this->expectException(\GuzzleHttp\Exception\RequestException::class); + $this->expectException(RequestException::class); $http = $this->prophesize(Client::class); $logger = $this->prophesize(LoggerChannelFactoryInterface::class); $config = $this->getConfigStub(); @@ -278,7 +279,7 @@ public function testSendRedirectError() { * Ensure files are validated before sending. */ public function testSendFileFileNoExist() { - $this->expectException(\Drupal\quant_api\Exception\InvalidPayload::class); + $this->expectException(InvalidPayload::class); // phpcs:ignore global $exists_return; // phpcs:ignore From a7d08c6abb9b747001270c3d0be7bce6663f5a9c Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Mon, 27 Jan 2025 20:35:06 -0800 Subject: [PATCH 08/20] Switch to Drupal 11 image. --- .github/workflows/ci.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7bca0ad9..e186d2bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,11 @@ +# To add new Drupal versions, update quant-ci-images repo. name: Test and code coverage on: - push jobs: lint: runs-on: ubuntu-latest - container: quantcdn/drupal-ci:9.4.x-dev + container: quantcdn/drupal-ci:11.0.x-dev steps: - uses: actions/checkout@v2 - name: Lint @@ -12,7 +13,7 @@ jobs: phpunit: runs-on: ubuntu-latest - container: quantcdn/drupal-ci:9.4.x-dev + container: quantcdn/drupal-ci:11.0.x-dev services: mariadb: @@ -20,7 +21,7 @@ jobs: ports: - 3306:3306 env: - MYSQL_DATABASE: drupal9 + MYSQL_DATABASE: drupal11 MYSQL_ROOT_PASSWORD: drupal MYSQL_USER: drupal MYSQL_PASSWORD: drupal @@ -32,7 +33,7 @@ jobs: steps: - name: Install Drupal - run: drush si --db-url=mysql://root:drupal@mariadb:3306/drupal9 -y + run: drush si --db-url=mysql://root:drupal@mariadb:3306/drupal11 -y working-directory: /var/www/drupal - name: Install module dependencies From 475eb79a5b15a4b84cca733fefba357e9a8e471e Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Tue, 28 Jan 2025 12:20:19 -0800 Subject: [PATCH 09/20] Update params to be nullable. --- modules/quant_api/src/Client/QuantClient.php | 2 +- modules/quant_api/src/Client/QuantClientInterface.php | 2 +- modules/quant_search/src/Form/ConfirmIndexClearForm.php | 2 +- src/Controller/QuantNodeViewController.php | 2 +- src/Event/ConfigFormEventBase.php | 2 +- src/Event/ConfigFormEventInterface.php | 2 +- src/Exception/ExpiredTokenException.php | 2 +- src/Exception/InvalidTokenException.php | 2 +- src/Exception/StrictTokenException.php | 2 +- src/Utility.php | 6 +++--- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/quant_api/src/Client/QuantClient.php b/modules/quant_api/src/Client/QuantClient.php index 1f03c168..534ad18a 100644 --- a/modules/quant_api/src/Client/QuantClient.php +++ b/modules/quant_api/src/Client/QuantClient.php @@ -270,7 +270,7 @@ public function sendRedirect(array $data) : array { /** * {@inheritdoc} */ - public function sendFile(string $file, string $url, int $rid = NULL) : array { + public function sendFile(string $file, string $url, ?int $rid = NULL) : array { // Ensure the file is accessible before attempting to send to the API. if (!file_exists($file) || !is_readable($file) || !is_file($file)) { diff --git a/modules/quant_api/src/Client/QuantClientInterface.php b/modules/quant_api/src/Client/QuantClientInterface.php index cc7a40fc..7266618b 100644 --- a/modules/quant_api/src/Client/QuantClientInterface.php +++ b/modules/quant_api/src/Client/QuantClientInterface.php @@ -65,7 +65,7 @@ public function send(array $data) : array; * @throws \Drupal\quant_api\Exception\InvalidPayload * @throws \Drupal\quant_api\Exception\InvalidResposne */ - public function sendFile(string $file, string $url, int $rid = NULL) : array; + public function sendFile(string $file, string $url, ?int $rid = NULL) : array; /** * Send a redirect to the API. diff --git a/modules/quant_search/src/Form/ConfirmIndexClearForm.php b/modules/quant_search/src/Form/ConfirmIndexClearForm.php index 43c32954..e97a16e1 100644 --- a/modules/quant_search/src/Form/ConfirmIndexClearForm.php +++ b/modules/quant_search/src/Form/ConfirmIndexClearForm.php @@ -14,7 +14,7 @@ class ConfirmIndexClearForm extends ConfirmFormBase { /** * {@inheritdoc} */ - public function buildForm(array $form, FormStateInterface $form_state, string $id = NULL) { + public function buildForm(array $form, FormStateInterface $form_state, ?string $id = NULL) { return parent::buildForm($form, $form_state); } diff --git a/src/Controller/QuantNodeViewController.php b/src/Controller/QuantNodeViewController.php index 7ab518b2..871ca147 100644 --- a/src/Controller/QuantNodeViewController.php +++ b/src/Controller/QuantNodeViewController.php @@ -53,7 +53,7 @@ class QuantNodeViewController extends NodeViewController { * @param \Drupal\Core\Session\AccountSwitcherInterface $account_switcher * The account switcher interface. */ - public function __construct(EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer, AccountInterface $current_user = NULL, EntityRepositoryInterface $entity_repository = NULL, RequestStack $request_stack, CurrentRouteMatch $route_match, AccountSwitcherInterface $account_switcher) { + public function __construct(EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer, ?AccountInterface $current_user = NULL, ?EntityRepositoryInterface $entity_repository = NULL, RequestStack $request_stack, CurrentRouteMatch $route_match, AccountSwitcherInterface $account_switcher) { parent::__construct($entity_type_manager, $renderer, $current_user, $entity_repository); $this->accountSwitcher = $account_switcher; diff --git a/src/Event/ConfigFormEventBase.php b/src/Event/ConfigFormEventBase.php index 43a06fa2..a8fa651c 100644 --- a/src/Event/ConfigFormEventBase.php +++ b/src/Event/ConfigFormEventBase.php @@ -36,7 +36,7 @@ class ConfigFormEventBase extends Event implements ConfigFormEventInterface { /** * {@inheritdoc} */ - public function __construct(FormStateInterface $form_state = NULL) { + public function __construct(?FormStateInterface $form_state = NULL) { $this->formState = $form_state; } diff --git a/src/Event/ConfigFormEventInterface.php b/src/Event/ConfigFormEventInterface.php index 7bdc3640..1cdea35e 100644 --- a/src/Event/ConfigFormEventInterface.php +++ b/src/Event/ConfigFormEventInterface.php @@ -15,7 +15,7 @@ interface ConfigFormEventInterface { * @param Drupal\Core\Form\FormStateInterface $form_state * The configuration values. */ - public function __construct(FormStateInterface $form_state = NULL); + public function __construct(?FormStateInterface $form_state = NULL); /** * Accessor for the form state. diff --git a/src/Exception/ExpiredTokenException.php b/src/Exception/ExpiredTokenException.php index 8fd3e46b..3780c286 100644 --- a/src/Exception/ExpiredTokenException.php +++ b/src/Exception/ExpiredTokenException.php @@ -31,7 +31,7 @@ class ExpiredTokenException extends \Exception { /** * {@inheritdoc} */ - public function __construct(string $token, int $time = 0, $sTime = 0, string $message = "The token has expired", int $code = 0, \Throwable $previous = NULL) { + public function __construct(string $token, int $time = 0, $sTime = 0, string $message = "The token has expired", int $code = 0, ?\Throwable $previous = NULL) { $this->token = $token; $this->time = $time; $this->sTime = $sTime; diff --git a/src/Exception/InvalidTokenException.php b/src/Exception/InvalidTokenException.php index 4591f82d..19a5df5e 100644 --- a/src/Exception/InvalidTokenException.php +++ b/src/Exception/InvalidTokenException.php @@ -24,7 +24,7 @@ class InvalidTokenException extends \Exception { /** * {@inheritdoc} */ - public function __construct(string $token, int $time = 0, string $message = "Invalid request token", int $code = 0, \Throwable $previous = NULL) { + public function __construct(string $token, int $time = 0, string $message = "Invalid request token", int $code = 0, ?\Throwable $previous = NULL) { $this->token = $token; $this->time = $time; diff --git a/src/Exception/StrictTokenException.php b/src/Exception/StrictTokenException.php index e6352187..39e9d8c9 100644 --- a/src/Exception/StrictTokenException.php +++ b/src/Exception/StrictTokenException.php @@ -31,7 +31,7 @@ class StrictTokenException extends \Exception { /** * {@inheritdoc} */ - public function __construct(string $token, $token_route = NULL, $expected_route = NULL, string $message = "The token routes do not match", int $code = 0, \Throwable $previous = NULL) { + public function __construct(string $token, $token_route = NULL, $expected_route = NULL, string $message = "The token routes do not match", int $code = 0, ?\Throwable $previous = NULL) { $this->token = $token; $this->tokenRoute = $token_route; $this->expectedRoute = $expected_route; diff --git a/src/Utility.php b/src/Utility.php index 44efaf51..ed57fa8b 100644 --- a/src/Utility.php +++ b/src/Utility.php @@ -45,7 +45,7 @@ public static function usesLanguagePathPrefixes() : bool { * @return string * The URL adjusted for multilingual settings. Defaults to current url. */ - public static function getUrl(string $url = NULL, string $langcode = NULL) : string { + public static function getUrl(?string $url = NULL, ?string $langcode = NULL) : string { // Default to current URL. if (!$url) { @@ -77,7 +77,7 @@ public static function getUrl(string $url = NULL, string $langcode = NULL) : str * @return string * The path prefix based on multilingual settings. Defaults to '/'. */ - public static function getPathPrefix(string $langcode = NULL) : string { + public static function getPathPrefix(?string $langcode = NULL) : string { // Always start with a slash. $prefix = '/'; @@ -200,7 +200,7 @@ public static function getSpecialPages() { * @return string * The markup with the page info. */ - public static function getPageInfo(array $urls = NULL) : string { + public static function getPageInfo(?array $urls = NULL) : string { try { // Only allow administrators and content editors access. $roles = ['administrator', 'content_editor', 'editor']; From 0862a690e4fe82826ad0cfc77e53ad2b419b9f19 Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Tue, 28 Jan 2025 12:24:26 -0800 Subject: [PATCH 10/20] Use generic database name. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e186d2bc..da07d8a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: ports: - 3306:3306 env: - MYSQL_DATABASE: drupal11 + MYSQL_DATABASE: drupal MYSQL_ROOT_PASSWORD: drupal MYSQL_USER: drupal MYSQL_PASSWORD: drupal @@ -33,7 +33,7 @@ jobs: steps: - name: Install Drupal - run: drush si --db-url=mysql://root:drupal@mariadb:3306/drupal11 -y + run: drush si --db-url=mysql://root:drupal@mariadb:3306/drupal -y working-directory: /var/www/drupal - name: Install module dependencies From f6e6b7ccc16d5e3e3bef8e510961f246a26efc4f Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Tue, 28 Jan 2025 17:54:13 -0800 Subject: [PATCH 11/20] Add warning if view has exposed filters. --- quant.module | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/quant.module b/quant.module index 150bc31a..ac0dff00 100644 --- a/quant.module +++ b/quant.module @@ -17,6 +17,7 @@ use Drupal\quant\Plugin\QueueItem\RouteItem; use Drupal\quant\QuantQueueFactory; use Drupal\quant\Seed; use Drupal\quant\Utility; +use Drupal\views\ViewExecutable; /** * Implements hook_menu_local_tasks_alter(). @@ -501,3 +502,16 @@ function quant_preprocess_views_view_table(&$variables) { } } } + +/** + * Implements hook_preprocess_views_view(). + */ +function quant_preprocess_views_view(array &$variables) { + /** @var ViewExecutable $view */ + $view = $variables['view']; + + // If the view has exposed filters, add a warning for admins. + if ($view->exposed_data && \Drupal::currentUser()->hasRole('administrator')) { + \Drupal::messenger()->addWarning(t('The view (@view_id) on this page has exposed filters which need special handling for a static website.
Review the documentation for your options.', ['@view_id' => $view->id()])); + } +} From 4346e1d7379c8e8c94b1dc9a09a95e38d9296452 Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Tue, 28 Jan 2025 20:49:34 -0800 Subject: [PATCH 12/20] Updated warning text. --- quant.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quant.module b/quant.module index ac0dff00..6acc973d 100644 --- a/quant.module +++ b/quant.module @@ -512,6 +512,6 @@ function quant_preprocess_views_view(array &$variables) { // If the view has exposed filters, add a warning for admins. if ($view->exposed_data && \Drupal::currentUser()->hasRole('administrator')) { - \Drupal::messenger()->addWarning(t('The view (@view_id) on this page has exposed filters which need special handling for a static website.
Review the documentation for your options.', ['@view_id' => $view->id()])); + \Drupal::messenger()->addWarning(t('The view (@view_id) on this page has exposed filters which need special handling for a static website.
See the documentation for your options.', ['@view_id' => $view->id()])); } } From 9f22756b63fe12da09e773ee0e80b7a2f7b31ea0 Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Tue, 28 Jan 2025 20:53:54 -0800 Subject: [PATCH 13/20] Fix linting. --- quant.module | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/quant.module b/quant.module index 6acc973d..c535fa5f 100644 --- a/quant.module +++ b/quant.module @@ -17,7 +17,6 @@ use Drupal\quant\Plugin\QueueItem\RouteItem; use Drupal\quant\QuantQueueFactory; use Drupal\quant\Seed; use Drupal\quant\Utility; -use Drupal\views\ViewExecutable; /** * Implements hook_menu_local_tasks_alter(). @@ -507,7 +506,7 @@ function quant_preprocess_views_view_table(&$variables) { * Implements hook_preprocess_views_view(). */ function quant_preprocess_views_view(array &$variables) { - /** @var ViewExecutable $view */ + /** @var \Drupal\views\ViewExecutable $view */ $view = $variables['view']; // If the view has exposed filters, add a warning for admins. From 87208ce4a850564e0c7c80f41bf401298088ecf8 Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Tue, 28 Jan 2025 21:24:37 -0800 Subject: [PATCH 14/20] Fix deprecation error for constructor. --- src/Controller/QuantNodeViewController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Controller/QuantNodeViewController.php b/src/Controller/QuantNodeViewController.php index 871ca147..9c348981 100644 --- a/src/Controller/QuantNodeViewController.php +++ b/src/Controller/QuantNodeViewController.php @@ -53,7 +53,8 @@ class QuantNodeViewController extends NodeViewController { * @param \Drupal\Core\Session\AccountSwitcherInterface $account_switcher * The account switcher interface. */ - public function __construct(EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer, ?AccountInterface $current_user = NULL, ?EntityRepositoryInterface $entity_repository = NULL, RequestStack $request_stack, CurrentRouteMatch $route_match, AccountSwitcherInterface $account_switcher) { + public function __construct(EntityTypeManagerInterface $entity_type_manager, RendererInterface $renderer, AccountInterface $current_user, EntityRepositoryInterface $entity_repository, RequestStack $request_stack, CurrentRouteMatch $route_match, AccountSwitcherInterface $account_switcher) { + parent::__construct($entity_type_manager, $renderer, $current_user, $entity_repository); $this->accountSwitcher = $account_switcher; From 4a63502591df89d6be47c4e0324bf4e56fdab35a Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Tue, 28 Jan 2025 22:39:38 -0800 Subject: [PATCH 15/20] Updated warning text. --- quant.module | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quant.module b/quant.module index c535fa5f..f9f14c95 100644 --- a/quant.module +++ b/quant.module @@ -511,6 +511,7 @@ function quant_preprocess_views_view(array &$variables) { // If the view has exposed filters, add a warning for admins. if ($view->exposed_data && \Drupal::currentUser()->hasRole('administrator')) { - \Drupal::messenger()->addWarning(t('The view (@view_id) on this page has exposed filters which need special handling for a static website.
See the documentation for your options.', ['@view_id' => $view->id()])); + \Drupal::messenger()->addWarning(t('The view (@view_id - @view_display) has exposed filters which need special handling for a static website.
See the documentation for your options.', ['@view_id' => $view->id(), '@view_display' => $view->current_display])); } + } From 1d4b30423a7d2fac61f3ba88d200fc10567df47e Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Fri, 31 Jan 2025 12:24:15 -0800 Subject: [PATCH 16/20] Fix lint error. --- quant.module | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/quant.module b/quant.module index f9f14c95..111fdbe0 100644 --- a/quant.module +++ b/quant.module @@ -511,7 +511,12 @@ function quant_preprocess_views_view(array &$variables) { // If the view has exposed filters, add a warning for admins. if ($view->exposed_data && \Drupal::currentUser()->hasRole('administrator')) { - \Drupal::messenger()->addWarning(t('The view (@view_id - @view_display) has exposed filters which need special handling for a static website.
See the documentation for your options.', ['@view_id' => $view->id(), '@view_display' => $view->current_display])); + \Drupal::messenger()->addWarning(t('The view (@view_id - @view_display) has exposed filters which need special handling for a static website.
See the documentation for your options.', + [ + '@view_id' => $view->id(), + '@view_display' => $view->current_display + ]) + ); } } From f661292c95adf62d60dddaa589d4917bde3a2e8d Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Fri, 31 Jan 2025 12:25:46 -0800 Subject: [PATCH 17/20] Linting. --- quant.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quant.module b/quant.module index 111fdbe0..f827a821 100644 --- a/quant.module +++ b/quant.module @@ -514,7 +514,7 @@ function quant_preprocess_views_view(array &$variables) { \Drupal::messenger()->addWarning(t('The view (@view_id - @view_display) has exposed filters which need special handling for a static website.
See the documentation for your options.', [ '@view_id' => $view->id(), - '@view_display' => $view->current_display + '@view_display' => $view->current_display, ]) ); } From 4cbd423b9c536d8547b595dfc1889e3bde64bca3 Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Fri, 31 Jan 2025 13:37:24 -0800 Subject: [PATCH 18/20] Add a warning if a webform is on the page. --- quant.module | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/quant.module b/quant.module index f827a821..bdb32e6f 100644 --- a/quant.module +++ b/quant.module @@ -6,6 +6,7 @@ */ use Drupal\Core\Access\AccessResult; +use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Session\AccountInterface; @@ -520,3 +521,26 @@ function quant_preprocess_views_view(array &$variables) { } } + +/** + * Implements hook_node_view(). + */ +function quant_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface $display, $view_mode) { + + // If there are any webforms in layout_builder, add warning for admins. + if ($node->hasField('layout_builder__layout') && !$node->get('layout_builder__layout')->isEmpty()) { + $sections = $node->get('layout_builder__layout')->getSections(); + + foreach ($sections as $section) { + $components = $section->getComponents(); + + foreach ($components as $component) { + $configuration = $component->get('configuration'); + if (isset($configuration['webform_id'])) { + \Drupal::messenger()->addWarning(t('Forms need special handling for a static website. See the documentation for your options.')); + return; + } + } + } + } +} From 6ac1d7bf070ac922cdd7e7b805289289ceae0c7f Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Fri, 31 Jan 2025 13:47:14 -0800 Subject: [PATCH 19/20] Only show warning to admins. --- quant.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quant.module b/quant.module index bdb32e6f..961e0cac 100644 --- a/quant.module +++ b/quant.module @@ -528,7 +528,7 @@ function quant_preprocess_views_view(array &$variables) { function quant_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface $display, $view_mode) { // If there are any webforms in layout_builder, add warning for admins. - if ($node->hasField('layout_builder__layout') && !$node->get('layout_builder__layout')->isEmpty()) { + if ($node->hasField('layout_builder__layout') && !$node->get('layout_builder__layout')->isEmpty() && \Drupal::currentUser()->hasRole('administrator')) { $sections = $node->get('layout_builder__layout')->getSections(); foreach ($sections as $section) { From 359541a5e53cdde2c4f1daa54e96f611f262688d Mon Sep 17 00:00:00 2001 From: Kristen Pol Date: Fri, 7 Mar 2025 13:09:48 -0800 Subject: [PATCH 20/20] Add autoconfigure to services yml. --- quant.services.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/quant.services.yml b/quant.services.yml index 98a79ca6..ee161c85 100644 --- a/quant.services.yml +++ b/quant.services.yml @@ -1,4 +1,7 @@ services: + _defaults: + autoconfigure: true + plugin.manager.quant.metadata: class: Drupal\quant\Plugin\QuantMetadataManager parent: default_plugin_manager