diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7bca0ad9..da07d8a4 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: drupal
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/drupal -y
working-directory: /var/www/drupal
- name: Install module dependencies
diff --git a/modules/quant_api/quant_api.info.yml b/modules/quant_api/quant_api.info.yml
index 4e8d0b8f..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: ^9.3 || ^10
+core_version_requirement: ^11
configure: quant_api.settings_form
dependencies:
- drupal:quant
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_api/src/EventSubscriber/QuantApi.php b/modules/quant_api/src/EventSubscriber/QuantApi.php
index 42a180cf..41b70df6 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;
@@ -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..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;
@@ -199,10 +200,9 @@ public function testSendValid() {
/**
* Ensure that send handles server errors.
- *
- * @expectedException GuzzleHttp\Exception\RequestException
*/
public function testSendError() {
+ $this->expectException(RequestException::class);
$http = $this->prophesize(Client::class);
$logger = $this->prophesize(LoggerChannelFactoryInterface::class);
$config = $this->getConfigStub();
@@ -254,10 +254,9 @@ public function testSendRedirectValid() {
/**
* Ensure a valid redirect response is sent.
- *
- * @expectedException GuzzleHttp\Exception\RequestException
*/
public function testSendRedirectError() {
+ $this->expectException(RequestException::class);
$http = $this->prophesize(Client::class);
$logger = $this->prophesize(LoggerChannelFactoryInterface::class);
$config = $this->getConfigStub();
@@ -278,10 +277,9 @@ public function testSendRedirectError() {
/**
* Ensure files are validated before sending.
- *
- * @expectedException Drupal\quant_api\Exception\InvalidPayload
*/
public function testSendFileFileNoExist() {
+ $this->expectException(InvalidPayload::class);
// phpcs:ignore
global $exists_return;
// phpcs:ignore
diff --git a/modules/quant_cron/quant_cron.info.yml b/modules/quant_cron/quant_cron.info.yml
index 61fe1670..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: ^9.3 || ^10
+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 5c819d3c..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: ^9.3 || ^10
+core_version_requirement: ^11
dependencies:
- quant:quant
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/quant_search.info.yml b/modules/quant_search/quant_search.info.yml
index 9baa8515..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: ^9.3 || ^10
+core_version_requirement: ^11
configure: quant_search.main
dependencies:
- drupal:quant
diff --git a/modules/quant_search/src/EventSubscriber/SearchEventSubscriber.php b/modules/quant_search/src/EventSubscriber/SearchEventSubscriber.php
index 9272f30e..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;
}
@@ -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_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/modules/quant_sitemap/quant_sitemap.info.yml b/modules/quant_sitemap/quant_sitemap.info.yml
index 824fb56b..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: ^9.3 || ^10
+core_version_requirement: ^11
dependencies:
- quant:quant_api
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..28e52704 100644
--- a/modules/quant_sitemap/tests/src/Unit/SitemapManagerTest.php
+++ b/modules/quant_sitemap/tests/src/Unit/SitemapManagerTest.php
@@ -157,7 +157,7 @@ public function testSitemapUnavailable() {
$entity_manager_mock,
$module_list_mock,
])
- ->setMethods(['isAvailable'])
+ ->onlyMethods(['isAvailable'])
->getMock();
$manager->expects($this->once())
@@ -197,7 +197,7 @@ public function testSimpleSitemapListItems() {
$entity_manager_mock,
$module_list_mock,
])
- ->setMethods(['isAvailable', 'getSitemapManager'])
+ ->onlyMethods(['isAvailable', 'getSitemapManager'])
->getMock();
$manager->expects($this->once())
diff --git a/modules/quant_tome/quant_tome.info.yml b/modules/quant_tome/quant_tome.info.yml
index 34a285ac..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: ^9.3 || ^10
+core_version_requirement: ^11
dependencies:
- tome:tome_static
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/modules/quant_webform/quant_webform.info.yml b/modules/quant_webform/quant_webform.info.yml
index 64b4b768..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: ^9.3 || ^10
+core_version_requirement: ^11
dependencies:
- quant:quant
diff --git a/quant.info.yml b/quant.info.yml
index 9ed0863e..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: ^9.3 || ^10
+core_version_requirement: ^11
configure: quant.config
dependencies:
- drupal:taxonomy
diff --git a/quant.module b/quant.module
index 150bc31a..961e0cac 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;
@@ -501,3 +502,45 @@ function quant_preprocess_views_view_table(&$variables) {
}
}
}
+
+/**
+ * Implements hook_preprocess_views_view().
+ */
+function quant_preprocess_views_view(array &$variables) {
+ /** @var \Drupal\views\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 - @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,
+ ])
+ );
+ }
+
+}
+
+/**
+ * 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() && \Drupal::currentUser()->hasRole('administrator')) {
+ $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;
+ }
+ }
+ }
+ }
+}
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
diff --git a/src/Controller/QuantNodeViewController.php b/src/Controller/QuantNodeViewController.php
index 7ab518b2..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;
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/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;
}
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 ba45e1c1..b19093bb 100644
--- a/src/Utility.php
+++ b/src/Utility.php
@@ -46,7 +46,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) {
@@ -78,7 +78,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 = '/';
@@ -203,6 +203,15 @@ public static function getSpecialPages() {
'/_quant403',
];
+ // Add translations of home page.
+ if (self::usesLanguagePathPrefixes()) {
+ if ($prefixes = \Drupal::config('language.negotiation')->get('url.prefixes')) {
+ foreach ($prefixes as $prefix) {
+ $pages[] = "/{$prefix}";
+ }
+ }
+ }
+
$validator = \Drupal::service('path.validator');
foreach ($pages as $index => $page) {
// Remove any pages that don't exist.
@@ -223,7 +232,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'];