From 8a5653d5d4d2a81f6b6d637ca0ddd8d65e169d4c Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Mon, 18 Dec 2023 15:45:26 +0200 Subject: [PATCH 01/27] Reroll patch for Drupal 10.2 --- ...--allow-menu-tree-manipulators-alter.patch | 488 ++++++++++++++++++ 1 file changed, 488 insertions(+) create mode 100644 patches/3091246--allow-menu-tree-manipulators-alter.patch diff --git a/patches/3091246--allow-menu-tree-manipulators-alter.patch b/patches/3091246--allow-menu-tree-manipulators-alter.patch new file mode 100644 index 000000000..701bf98b0 --- /dev/null +++ b/patches/3091246--allow-menu-tree-manipulators-alter.patch @@ -0,0 +1,488 @@ +diff --git a/core/core.services.yml b/core/core.services.yml +index 72ff560296..e245aa5a95 100644 +--- a/core/core.services.yml ++++ b/core/core.services.yml +@@ -773,7 +773,7 @@ services: + Drupal\Core\Menu\MenuLinkManagerInterface: '@plugin.manager.menu.link' + menu.link_tree: + class: Drupal\Core\Menu\MenuLinkTree +- arguments: ['@menu.tree_storage', '@plugin.manager.menu.link', '@router.route_provider', '@menu.active_trail', '@callable_resolver'] ++ arguments: ['@menu.tree_storage', '@plugin.manager.menu.link', '@router.route_provider', '@menu.active_trail', '@callable_resolver', '@event_dispatcher'] + Drupal\Core\Menu\MenuLinkTreeInterface: '@menu.link_tree' + menu.default_tree_manipulators: + class: Drupal\Core\Menu\DefaultMenuLinkTreeManipulators +diff --git a/core/lib/Drupal/Core/Menu/MenuLinkBase.php b/core/lib/Drupal/Core/Menu/MenuLinkBase.php +index 7757f45159..6ef381f6e1 100644 +--- a/core/lib/Drupal/Core/Menu/MenuLinkBase.php ++++ b/core/lib/Drupal/Core/Menu/MenuLinkBase.php +@@ -3,7 +3,7 @@ + namespace Drupal\Core\Menu; + + use Drupal\Component\Plugin\Exception\PluginException; +-use Drupal\Core\Cache\Cache; ++use Drupal\Core\Cache\RefinableCacheableDependencyTrait; + use Drupal\Core\Plugin\PluginBase; + use Drupal\Core\Url; + +@@ -12,6 +12,8 @@ + */ + abstract class MenuLinkBase extends PluginBase implements MenuLinkInterface { + ++ use RefinableCacheableDependencyTrait; ++ + /** + * The list of definition values where an override is allowed. + * +@@ -209,25 +211,4 @@ public function deleteLink() { + throw new PluginException("Menu link plugin with ID '{$this->getPluginId()}' does not support deletion"); + } + +- /** +- * {@inheritdoc} +- */ +- public function getCacheMaxAge() { +- return Cache::PERMANENT; +- } +- +- /** +- * {@inheritdoc} +- */ +- public function getCacheContexts() { +- return []; +- } +- +- /** +- * {@inheritdoc} +- */ +- public function getCacheTags() { +- return []; +- } +- + } +diff --git a/core/lib/Drupal/Core/Menu/MenuLinkInterface.php b/core/lib/Drupal/Core/Menu/MenuLinkInterface.php +index 0699aef361..4a420627fc 100644 +--- a/core/lib/Drupal/Core/Menu/MenuLinkInterface.php ++++ b/core/lib/Drupal/Core/Menu/MenuLinkInterface.php +@@ -4,13 +4,13 @@ + + use Drupal\Component\Plugin\PluginInspectionInterface; + use Drupal\Component\Plugin\DerivativeInspectionInterface; +-use Drupal\Core\Cache\CacheableDependencyInterface; ++use Drupal\Core\Cache\RefinableCacheableDependencyInterface; + use Drupal\Core\Url; + + /** + * Defines an interface for classes providing a type of menu link. + */ +-interface MenuLinkInterface extends PluginInspectionInterface, DerivativeInspectionInterface, CacheableDependencyInterface { ++interface MenuLinkInterface extends PluginInspectionInterface, DerivativeInspectionInterface, RefinableCacheableDependencyInterface { + + /** + * Returns the weight of the menu link. +diff --git a/core/lib/Drupal/Core/Menu/MenuLinkTree.php b/core/lib/Drupal/Core/Menu/MenuLinkTree.php +index 15d9c71050..a98626ba1b 100644 +--- a/core/lib/Drupal/Core/Menu/MenuLinkTree.php ++++ b/core/lib/Drupal/Core/Menu/MenuLinkTree.php +@@ -2,6 +2,7 @@ + + namespace Drupal\Core\Menu; + ++use Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher; + use Drupal\Component\Utility\NestedArray; + use Drupal\Core\Access\AccessResultInterface; + use Drupal\Core\Cache\CacheableMetadata; +@@ -51,6 +52,13 @@ class MenuLinkTree implements MenuLinkTreeInterface { + */ + protected CallableResolver $callableResolver; + ++ /** ++ * The event dispatcher. ++ * ++ * @var \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher ++ */ ++ protected $eventDispatcher; ++ + /** + * Constructs a \Drupal\Core\Menu\MenuLinkTree object. + * +@@ -64,8 +72,10 @@ class MenuLinkTree implements MenuLinkTreeInterface { + * The active menu trail service. + * @param \Drupal\Core\Utility\CallableResolver|\Drupal\Core\Controller\ControllerResolverInterface $callable_resolver + * The callable resolver. ++ * @param \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher|null $eventDispatcher ++ * The event dispatcher. + */ +- public function __construct(MenuTreeStorageInterface $tree_storage, MenuLinkManagerInterface $menu_link_manager, RouteProviderInterface $route_provider, MenuActiveTrailInterface $menu_active_trail, ControllerResolverInterface|CallableResolver $callable_resolver) { ++ public function __construct(MenuTreeStorageInterface $tree_storage, MenuLinkManagerInterface $menu_link_manager, RouteProviderInterface $route_provider, MenuActiveTrailInterface $menu_active_trail, ControllerResolverInterface|CallableResolver $callable_resolver, ContainerAwareEventDispatcher $eventDispatcher = NULL) { + $this->treeStorage = $tree_storage; + $this->menuLinkManager = $menu_link_manager; + $this->routeProvider = $route_provider; +@@ -75,6 +85,11 @@ public function __construct(MenuTreeStorageInterface $tree_storage, MenuLinkMana + $callable_resolver = \Drupal::service('callable_resolver'); + } + $this->callableResolver = $callable_resolver; ++ if ($eventDispatcher === NULL) { ++ @trigger_error('The event_dispatcher service must be passed to ' . __NAMESPACE__ . '\MenuLinkTree::__construct(). It was added in drupal:10.3.0 and will be required before drupal:11.0.0.', E_USER_DEPRECATED); ++ $eventDispatcher = \Drupal::service('event_dispatcher'); ++ } ++ $this->eventDispatcher = $eventDispatcher; + } + + /** +@@ -141,6 +156,7 @@ protected function createInstances(array $data_tree) { + * {@inheritdoc} + */ + public function transform(array $tree, array $manipulators) { ++ $this->eventDispatcher->dispatch(new MenuLinkTreeManipulatorsAlterEvent($tree, $manipulators, $this), MenuLinkTreeEvents::ALTER_MANIPULATORS); + foreach ($manipulators as $manipulator) { + $callable = $this->callableResolver->getCallableFromDefinition($manipulator['callable']); + // Prepare the arguments for the menu tree manipulator callable; the first +diff --git a/core/lib/Drupal/Core/Menu/MenuLinkTreeEvents.php b/core/lib/Drupal/Core/Menu/MenuLinkTreeEvents.php +new file mode 100644 +index 0000000000..c72f39f38d +--- /dev/null ++++ b/core/lib/Drupal/Core/Menu/MenuLinkTreeEvents.php +@@ -0,0 +1,24 @@ ++tree = $tree; ++ $this->manipulators = &$manipulators; ++ $this->menuLinkTree = $menuLinkTree; ++ } ++ ++ /** ++ * The MenuLinkElement tree. ++ * ++ * @return \Drupal\Core\Menu\MenuLinkTreeElement[] ++ * The menu tree. ++ */ ++ public function getTree(): array { ++ return $this->tree; ++ } ++ ++ /** ++ * Get the manipulators for the tree. ++ * ++ * @return array ++ * The menu tree manipulators. ++ */ ++ public function &getManipulators(): array { ++ return $this->manipulators; ++ } ++ ++ /** ++ * Set the manipulators for the tree. ++ * ++ * @param array $manipulators ++ * The menu tree manipulators. ++ */ ++ public function setManipulators(array $manipulators): void { ++ $this->manipulators = $manipulators; ++ } ++ ++ /** ++ * The MenuLinkTree. ++ * ++ * @return \Drupal\Core\Menu\MenuLinkTreeInterface ++ * The menu link tree. ++ */ ++ public function getMenuLinkTree(): MenuLinkTreeInterface { ++ return $this->menuLinkTree; ++ } ++ ++} +diff --git a/core/modules/system/tests/modules/menu_test/menu_test.routing.yml b/core/modules/system/tests/modules/menu_test/menu_test.routing.yml +index 5b83aeb2af..2f3211a77d 100644 +--- a/core/modules/system/tests/modules/menu_test/menu_test.routing.yml ++++ b/core/modules/system/tests/modules/menu_test/menu_test.routing.yml +@@ -544,3 +544,27 @@ menu_test.breadcrumb3: + _title: 'Normal title' + requirements: + _access: 'TRUE' ++ ++menu_test.manipulator1: ++ path: '/menu-test/manipulators/1' ++ defaults: ++ _controller: '\Drupal\menu_test\Controller\MenuTestController::menuTestCallback' ++ _title: 'Link 1' ++ requirements: ++ _access: 'TRUE' ++ ++menu_test.manipulator2: ++ path: '/menu-test/manipulators/2' ++ defaults: ++ _controller: '\Drupal\menu_test\Controller\MenuTestController::menuTestCallback' ++ _title: 'Link 2' ++ requirements: ++ _access: 'TRUE' ++ ++menu_test.manipulator3: ++ path: '/menu-test/manipulators/3' ++ defaults: ++ _controller: '\Drupal\menu_test\Controller\MenuTestController::menuTestCallback' ++ _title: 'Link 1' ++ requirements: ++ _access: 'TRUE' +diff --git a/core/modules/system/tests/modules/menu_test/menu_test.services.yml b/core/modules/system/tests/modules/menu_test/menu_test.services.yml +index e1a0aa059b..759dd1a5b5 100644 +--- a/core/modules/system/tests/modules/menu_test/menu_test.services.yml ++++ b/core/modules/system/tests/modules/menu_test/menu_test.services.yml +@@ -9,3 +9,8 @@ services: + arguments: ['@request_stack'] + tags: + - { name: access_check, applies_to: _menu_test_session_access } ++ ++ menu_test.event_subscriber.menu_link_tree: ++ class: Drupal\menu_test\EventSubscriber\MenuLinkTreeEventSubscriber ++ tags: ++ - { name: event_subscriber } +diff --git a/core/modules/system/tests/modules/menu_test/src/EventSubscriber/MenuLinkTreeEventSubscriber.php b/core/modules/system/tests/modules/menu_test/src/EventSubscriber/MenuLinkTreeEventSubscriber.php +new file mode 100644 +index 0000000000..7133785d3d +--- /dev/null ++++ b/core/modules/system/tests/modules/menu_test/src/EventSubscriber/MenuLinkTreeEventSubscriber.php +@@ -0,0 +1,36 @@ ++getManipulators(); ++ // Append the test menu link manipulator. ++ $manipulators[] = ['callable' => MenuLinkManipulators::getTestManipulator()]; ++ } ++ ++ /** ++ * {@inheritdoc} ++ */ ++ public static function getSubscribedEvents() { ++ return [ ++ MenuLinkTreeEvents::ALTER_MANIPULATORS => ['alterMenuLinkManipulators'], ++ ]; ++ } ++ ++} +diff --git a/core/modules/system/tests/modules/menu_test/src/MenuLinkManipulators.php b/core/modules/system/tests/modules/menu_test/src/MenuLinkManipulators.php +new file mode 100644 +index 0000000000..fd3d08c68a +--- /dev/null ++++ b/core/modules/system/tests/modules/menu_test/src/MenuLinkManipulators.php +@@ -0,0 +1,53 @@ ++ $element) { ++ $link = $tree[$key]->link; ++ $url = $link->getUrlObject(); ++ if ($url->isRouted()) { ++ $manipulators = ['menu_test.manipulator2', 'menu_test.manipulator3']; ++ if (in_array($url->getRouteName(), $manipulators)) { ++ $tree[$key]->options['attributes']['class'][] = 'menu-test-link'; ++ } ++ } ++ } ++ return $tree; ++ } ++ ++ /** ++ * Gets the name of menu manipulator. ++ * ++ * @return string ++ * The manipulator name. ++ */ ++ public static function getTestManipulator() { ++ return self::class . ":testManipulator"; ++ } ++ ++} +diff --git a/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php b/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php +index 6032ff399d..7e77e717ef 100644 +--- a/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php ++++ b/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php +@@ -37,7 +37,8 @@ protected function setUp(): void { + $this->createMock('\Drupal\Core\Menu\MenuLinkManagerInterface'), + $this->createMock('\Drupal\Core\Routing\RouteProviderInterface'), + $this->createMock('\Drupal\Core\Menu\MenuActiveTrailInterface'), +- $this->createMock(CallableResolver::class) ++ $this->createMock(CallableResolver::class), ++ $this->createMock('\Symfony\Component\EventDispatcher\EventDispatcherInterface') + ); + + $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') +diff --git a/core/modules/toolbar/toolbar.services.yml b/core/modules/toolbar/toolbar.services.yml +index b70f8b9df9..1cf25ff3e4 100644 +--- a/core/modules/toolbar/toolbar.services.yml ++++ b/core/modules/toolbar/toolbar.services.yml +@@ -11,4 +11,4 @@ services: + - { name: page_cache_request_policy } + toolbar.menu_tree: + class: Drupal\toolbar\Menu\ToolbarMenuLinkTree +- arguments: ['@menu.tree_storage', '@plugin.manager.menu.link', '@router.route_provider', '@menu.active_trail', '@callable_resolver'] ++ arguments: ['@menu.tree_storage', '@plugin.manager.menu.link', '@router.route_provider', '@menu.active_trail', '@callable_resolver', '@event_dispatcher'] +diff --git a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php +index c36c37fea9..f59b7b53ea 100644 +--- a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php ++++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php +@@ -133,4 +133,49 @@ public function testCreateLinksInMenu() { + $this->assertEquals(3, $height); + } + ++ /** ++ * Tests menu link manipulator alter events. ++ */ ++ public function testMenuManipulatorAlter() { ++ $links = [ ++ 1 => MenuLinkMock::create([ ++ 'id' => 'test.link1', ++ 'route_name' => 'menu_test.manipulator1', ++ 'title' => 'Link 1', ++ 'parent' => '', ++ ]), ++ 2 => MenuLinkMock::create([ ++ 'id' => 'test.link2', ++ 'route_name' => 'menu_test.manipulator2', ++ 'title' => 'Link 2', ++ 'parent' => '', ++ ]), ++ 3 => MenuLinkMock::create([ ++ 'id' => 'test.link3', ++ 'route_name' => 'menu_test.manipulator3', ++ 'title' => 'Link 3', ++ 'parent' => '', ++ ]), ++ ]; ++ foreach ($links as $instance) { ++ $this->menuLinkManager->addDefinition($instance->getPluginId(), ++ $instance->getPluginDefinition()); ++ } ++ $parameters = new MenuTreeParameters(); ++ $tree = $this->linkTree->load('mock', $parameters); ++ $manipulators = [ ++ ['callable' => 'menu.default_tree_manipulators:generateIndexAndSort'], ++ ]; ++ $tree = $this->linkTree->transform($tree, $manipulators); ++ ++ $this->assertCount(3, $tree); ++ /** @var \Drupal\Core\Menu\MenuLinkTreeElement[] $tree */ ++ list($link1, $link2, $link3) = array_values($tree); ++ ++ // Check that the correct links have an additional class. ++ $this->assertNotContains('menu-test-link', $link1->options['attributes']['class'] ?? []); ++ $this->assertContains('menu-test-link', $link2->options['attributes']['class'] ?? []); ++ $this->assertContains('menu-test-link', $link3->options['attributes']['class'] ?? []); ++ } ++ + } From c72fe7a7c470309e7c36aef4aa27bb9fa80f7655 Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Mon, 18 Dec 2023 15:46:43 +0200 Subject: [PATCH 02/27] Replace failing patch --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index ca83a822c..499c0498e 100644 --- a/composer.json +++ b/composer.json @@ -62,7 +62,7 @@ "php": "^8.1" }, "conflict": { - "drupal/core": "<10.1", + "drupal/core": "<10.2", "drupal/ctools": "<3.11 || ^4.0.1", "drupal/helfi_media_map": "*", "drush/drush": "<12" @@ -74,7 +74,7 @@ "https://www.drupal.org/project/content_lock/issues/3343964": "https://www.drupal.org/files/issues/2023-05-22/3343964-5.patch" }, "drupal/core": { - "[#UHF-181] Hide untranslated menu links (https://www.drupal.org/project/drupal/issues/3091246)": "https://www.drupal.org/files/issues/2023-10-02/3091246--allow-menu-tree-manipulators-alter--23.patch", + "[#UHF-181] Hide untranslated menu links (https://www.drupal.org/project/drupal/issues/3091246)": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/UHF-X-drupal-10.2/patches/3091246--allow-menu-tree-manipulators-alter.patch", "[#UHF-3812] Ajax exposed filters not working for multiple instances of the same Views block placed on one page (https://www.drupal.org/project/drupal/issues/3163299)": "https://www.drupal.org/files/issues/2023-05-07/3163299-104-D10.patch", "[#UHF-4325] Strip whitespaces from twig debug comments": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/b628bc051d82a1883768364050aa833824bd48c8/patches/drupal_core_strip_debug_mode_whitespaces_10.1.x.patch", "[#UHF-7008] Core localization file download URL is wrong (https://www.drupal.org/project/drupal/issues/3022876)": "https://git.drupalcode.org/project/drupal/-/commit/40a96136b2dfe4322338508dffa636f6cb407900.patch", From 19d7939b193a2ee5c2bcd51ce4d0a1457621cad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 18 Dec 2023 16:18:40 +0200 Subject: [PATCH 03/27] Re-rolled drupal-2313309-render-admin-toolbar-with-admin-language.patch for drupal 10.2 --- ...er-admin-toolbar-with-admin-language.patch | 119 +++++++++++------- 1 file changed, 77 insertions(+), 42 deletions(-) diff --git a/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch b/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch index 5265e7f21..c218d3c84 100644 --- a/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch +++ b/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch @@ -1,8 +1,8 @@ diff --git a/core/core.services.yml b/core/core.services.yml -index e3c1e094a2..fddf15bc5a 100644 +index 72ff560296..9bc32c499f 100644 --- a/core/core.services.yml +++ b/core/core.services.yml -@@ -155,6 +155,11 @@ services: +@@ -162,6 +162,11 @@ services: arguments: ['@current_user'] tags: - { name: cache.context} @@ -74,20 +74,20 @@ index 0000000000..c827e14738 + +} diff --git a/core/misc/cspell/dictionary.txt b/core/misc/cspell/dictionary.txt -index 85c72239cf..83a98f5807 100644 +index 8fcbd4fe32..e867034f7a 100644 --- a/core/misc/cspell/dictionary.txt +++ b/core/misc/cspell/dictionary.txt -@@ -415,6 +415,8 @@ enim +@@ -287,6 +287,8 @@ endtrans + enim enoki - enregistrer entit +entitynodedelete +entitynodeedit entitytype entityviewedit - eridani + errmode diff --git a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php -index 985d4c44c3..8a394c45b0 100644 +index 043474f072..40bb2304b3 100644 --- a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php +++ b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php @@ -387,9 +387,9 @@ public function testBlockContextualLinks() { @@ -116,10 +116,10 @@ index 16e147d99c..c2ce954c19 100644 } diff --git a/core/modules/contextual/contextual.module b/core/modules/contextual/contextual.module -index 5e0b67826c..abf90ffb5e 100644 +index 96ab68dd1b..3276e354fe 100644 --- a/core/modules/contextual/contextual.module +++ b/core/modules/contextual/contextual.module -@@ -174,13 +174,15 @@ function contextual_contextual_links_view_alter(&$element, $items) { +@@ -174,13 +174,18 @@ function contextual_contextual_links_view_alter(&$element, $items) { function _contextual_links_to_id($contextual_links) { $ids = []; $langcode = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_URL)->getId(); @@ -133,15 +133,18 @@ index 5e0b67826c..abf90ffb5e 100644 - $args['metadata'] += ['langcode' => $langcode]; + // language-aware contextual links on the client side. Add the admin + // language as the link text can vary by that. -+ $args['metadata'] += ['langcode' => $langcode, 'admin_langcode' => $admin_langcode]; ++ $args['metadata'] += [ ++ 'langcode' => $langcode, ++ 'admin_langcode' => $admin_langcode, ++ ]; $metadata = UrlHelper::buildQuery($args['metadata']); $ids[] = "{$group}:{$route_parameters}:{$metadata}"; } diff --git a/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php b/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php -index f1fb389b0d..62843072e6 100644 +index b1f048d715..04d8215b41 100644 --- a/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php +++ b/core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php -@@ -101,10 +101,10 @@ public function testDifferentPermissions() { +@@ -100,10 +100,10 @@ public function testDifferentPermissions() { // Now, on the front page, all article nodes should have contextual links // placeholders, as should the view that contains them. $ids = [ @@ -156,7 +159,7 @@ index f1fb389b0d..62843072e6 100644 ]; // Editor user: can access contextual links and can edit articles. -@@ -125,7 +125,7 @@ public function testDifferentPermissions() { +@@ -124,7 +124,7 @@ public function testDifferentPermissions() { // Verify that link language is properly handled. $node3->addTranslation('it')->set('title', $this->randomString())->save(); @@ -165,7 +168,7 @@ index f1fb389b0d..62843072e6 100644 $this->drupalGet('node', ['language' => ConfigurableLanguage::createFromLangcode('it')]); $this->assertContextualLinkPlaceHolder($id); -@@ -174,7 +174,7 @@ public function testTokenProtection() { +@@ -178,7 +178,7 @@ public function testTokenProtection() { // Now, on the front page, all article nodes should have contextual links // placeholders, as should the view that contains them. @@ -368,7 +371,7 @@ index dc46bef32a..6050622ff4 100644 return $tests; diff --git a/core/modules/language/language.module b/core/modules/language/language.module -index 91641dec56..ff39b7bba7 100644 +index 88a25d030d..b60c0163cc 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -16,6 +16,7 @@ @@ -395,16 +398,19 @@ index 91641dec56..ff39b7bba7 100644 /** diff --git a/core/modules/language/language.services.yml b/core/modules/language/language.services.yml -index 4fda6484c1..23e3da20cc 100644 +index ffc267f3f5..d73b8a6e2b 100644 --- a/core/modules/language/language.services.yml +++ b/core/modules/language/language.services.yml -@@ -24,3 +24,6 @@ services: +@@ -27,3 +27,9 @@ services: tags: - { name: paramconverter } lazy: true + language.admin_language_render: + class: Drupal\language\AdminLanguageRender + arguments: ['@language_manager', '@string_translation', '@current_user'] ++ language.admin_language_render: ++ class: Drupal\language\AdminLanguageRender ++ arguments: ['@language_manager', '@string_translation', '@current_user'] diff --git a/core/modules/language/src/AdminLanguageRender.php b/core/modules/language/src/AdminLanguageRender.php new file mode 100644 index 0000000000..16d1587479 @@ -543,10 +549,10 @@ index 0000000000..16d1587479 + +} diff --git a/core/modules/language/src/ConfigurableLanguageManager.php b/core/modules/language/src/ConfigurableLanguageManager.php -index 9dd65ff495..61f6b9bede 100644 +index c4187aaf60..d78a8fc331 100644 --- a/core/modules/language/src/ConfigurableLanguageManager.php +++ b/core/modules/language/src/ConfigurableLanguageManager.php -@@ -235,6 +235,18 @@ public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE) { +@@ -235,6 +235,25 @@ public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE) { return $this->negotiatedLanguages[$type]; } @@ -561,15 +567,42 @@ index 9dd65ff495..61f6b9bede 100644 + public function setCurrentLanguage(LanguageInterface $language, $type = LanguageInterface::TYPE_INTERFACE) { + $this->negotiatedLanguages[$type] = $language; + } ++ ++ /** ++ * {@inheritdoc} ++ */ ++ public function setCurrentLanguage(LanguageInterface $language, ?string $type = LanguageInterface::TYPE_INTERFACE): void { ++ $this->negotiatedLanguages[$type] = $language; ++ } + /** * {@inheritdoc} */ +diff --git a/core/modules/language/src/ConfigurableLanguageManagerInterface.php b/core/modules/language/src/ConfigurableLanguageManagerInterface.php +index 41a1681f3f..2b8984e6c6 100644 +--- a/core/modules/language/src/ConfigurableLanguageManagerInterface.php ++++ b/core/modules/language/src/ConfigurableLanguageManagerInterface.php +@@ -103,4 +103,15 @@ public function getStandardLanguageListWithoutConfigured(); + */ + public function getNegotiatedLanguageMethod($type = LanguageInterface::TYPE_INTERFACE); + ++ /** ++ * Sets the current language. ++ * ++ * @param \Drupal\Core\Language\LanguageInterface $language ++ * The language to set. ++ * @param string|null $type ++ * (optional) The language type; e.g., the interface or the content ++ * language. ++ */ ++ public function setCurrentLanguage(LanguageInterface $language, ?string $type = LanguageInterface::TYPE_INTERFACE): void; ++ + } diff --git a/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php -index 3079352f8e..7d09fcaf57 100644 +index be99b93902..d7992fd199 100644 --- a/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php +++ b/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php -@@ -58,9 +58,8 @@ public function testToolbarClasses() { +@@ -60,9 +60,8 @@ public function testToolbarClasses() { $langcode = 'es'; // Add Spanish. @@ -580,7 +613,7 @@ index 3079352f8e..7d09fcaf57 100644 // The menu item 'Structure' in the toolbar will be translated. $menu_item = 'Structure'; -@@ -68,49 +67,108 @@ public function testToolbarClasses() { +@@ -70,49 +69,108 @@ public function testToolbarClasses() { // Visit a page that has the string on it so it can be translated. $this->drupalGet($langcode . '/admin/structure'); @@ -724,7 +757,7 @@ index 10e6cc3295..80d6d19ff2 100644 + options: + _admin_route: TRUE diff --git a/core/modules/user/src/ToolbarLinkBuilder.php b/core/modules/user/src/ToolbarLinkBuilder.php -index b278db6dba..0c48bec2fe 100644 +index 8d989b339e..21761a8403 100644 --- a/core/modules/user/src/ToolbarLinkBuilder.php +++ b/core/modules/user/src/ToolbarLinkBuilder.php @@ -2,10 +2,12 @@ @@ -740,17 +773,17 @@ index b278db6dba..0c48bec2fe 100644 /** * ToolbarLinkBuilder fills out the placeholders generated in user_toolbar(). -@@ -21,14 +23,24 @@ class ToolbarLinkBuilder implements TrustedCallbackInterface { - */ - protected $account; +@@ -14,21 +16,18 @@ class ToolbarLinkBuilder implements TrustedCallbackInterface { -+ /** -+ * The module handler. -+ * -+ * @var \Drupal\Core\Extension\ModuleHandlerInterface -+ */ -+ protected $moduleHandler; -+ + use StringTranslationTrait; + +- /** +- * The current user. +- * +- * @var \Drupal\Core\Session\AccountProxyInterface +- */ +- protected $account; +- /** * ToolbarHandler constructor. * @@ -760,13 +793,15 @@ index b278db6dba..0c48bec2fe 100644 + * The module handler. */ - public function __construct(AccountProxyInterface $account) { -+ public function __construct(AccountProxyInterface $account, ModuleHandlerInterface $moduleHandler) { - $this->account = $account; -+ $this->moduleHandler = $moduleHandler; +- $this->account = $account; ++ public function __construct( ++ protected AccountProxyInterface $account, ++ protected ModuleHandlerInterface $moduleHandler ++ ) { } /** -@@ -69,6 +81,11 @@ public function renderToolbarLinks() { +@@ -69,6 +68,11 @@ public function renderToolbarLinks() { ], ]; @@ -779,23 +814,23 @@ index b278db6dba..0c48bec2fe 100644 } diff --git a/core/modules/user/user.services.yml b/core/modules/user/user.services.yml -index f8f7d15f4e..76f15a5e5a 100644 +index d2d2720bd1..3afc508061 100644 --- a/core/modules/user/user.services.yml +++ b/core/modules/user/user.services.yml -@@ -59,7 +59,7 @@ services: +@@ -62,7 +62,7 @@ services: - { name: 'context_provider' } user.toolbar_link_builder: class: Drupal\user\ToolbarLinkBuilder - arguments: ['@current_user'] + arguments: ['@current_user', '@module_handler'] + Drupal\user\ToolbarLinkBuilder: '@user.toolbar_link_builder' user.flood_control: class: Drupal\user\UserFloodControl - arguments: ['@flood', '@event_dispatcher', '@request_stack'] diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php -index 559acbb481..b3a67aa96b 100644 +index 70fb850e6e..173c4a33ca 100644 --- a/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php +++ b/core/modules/views_ui/tests/src/FunctionalJavascript/DisplayTest.php -@@ -128,7 +128,7 @@ public function testPageContextualLinks() { +@@ -130,7 +130,7 @@ public function testPageContextualLinks() { $element = $this->getSession()->getPage()->find('css', $selector); $element->find('css', '.contextual button')->press(); From bfa3431f00bb5633bd4f9ec0a25db3f60e3e88cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 18 Dec 2023 16:21:50 +0200 Subject: [PATCH 04/27] Applied the drupal-2313309-render-admin-toolbar-with-admin-language.patch --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 499c0498e..e93c75b39 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,7 @@ "[#UHF-4325] Strip whitespaces from twig debug comments": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/b628bc051d82a1883768364050aa833824bd48c8/patches/drupal_core_strip_debug_mode_whitespaces_10.1.x.patch", "[#UHF-7008] Core localization file download URL is wrong (https://www.drupal.org/project/drupal/issues/3022876)": "https://git.drupalcode.org/project/drupal/-/commit/40a96136b2dfe4322338508dffa636f6cb407900.patch", "[#UHF-7008] Add multilingual support for caching basefield definitions (https://www.drupal.org/project/drupal/issues/3114824)": "https://www.drupal.org/files/issues/2020-02-20/3114824_2.patch", - "[#UHF-7008] Admin toolbar and contextual links should always be rendered in the admin language (https://www.drupal.org/project/drupal/issues/2313309)": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/a42c905a162c8510348b17cdf60000a0a7f82037/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch", + "[#UHF-7008] Admin toolbar and contextual links should always be rendered in the admin language (https://www.drupal.org/project/drupal/issues/2313309)": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/5e0ae3b4033383cbca9e67f4f8047b1b515030f2/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch", "[#UHF-9388] Process translation config files for custom modules (https://www.drupal.org/i/2845437)": "https://www.drupal.org/files/issues/2023-10-16/2845437-61.patch" }, "drupal/default_content": { From ad3b32d7f301939ca565fdf4c7afa5855df78123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 18 Dec 2023 16:38:09 +0200 Subject: [PATCH 05/27] Lock simple_sitemap module to 4.1.7 as the patch for solving this issue: https://www.drupal.org/i/3264573 will fail to apply in 4.1.8. This issue will be solved in UHF-9273. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e93c75b39..e7786eb2e 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "drupal/scheduler": "^1.3", "drupal/search_api": "^1.0", "drupal/select2": "^1.12", - "drupal/simple_sitemap": "^4.1", + "drupal/simple_sitemap": "4.1.7", "drupal/siteimprove": "^2.0", "drupal/social_media": "^2.0", "drupal/stomp": "^2.0", From bef6ef3fd7205713749be2f4bdf63f5288a11c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 18 Dec 2023 16:45:38 +0200 Subject: [PATCH 06/27] Fixed duplicated key in language.services.yml in drupal-2313309-render-admin-toolbar-with-admin-language.patch --- ...upal-2313309-render-admin-toolbar-with-admin-language.patch | 3 --- 1 file changed, 3 deletions(-) diff --git a/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch b/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch index c218d3c84..b6260f67f 100644 --- a/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch +++ b/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch @@ -408,9 +408,6 @@ index ffc267f3f5..d73b8a6e2b 100644 + language.admin_language_render: + class: Drupal\language\AdminLanguageRender + arguments: ['@language_manager', '@string_translation', '@current_user'] -+ language.admin_language_render: -+ class: Drupal\language\AdminLanguageRender -+ arguments: ['@language_manager', '@string_translation', '@current_user'] diff --git a/core/modules/language/src/AdminLanguageRender.php b/core/modules/language/src/AdminLanguageRender.php new file mode 100644 index 0000000000..16d1587479 From e6ff0437c9b069029b33cb89350ba866c289691e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 18 Dec 2023 16:47:30 +0200 Subject: [PATCH 07/27] Applied fixed patch. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e7786eb2e..f32702b6d 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,7 @@ "[#UHF-4325] Strip whitespaces from twig debug comments": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/b628bc051d82a1883768364050aa833824bd48c8/patches/drupal_core_strip_debug_mode_whitespaces_10.1.x.patch", "[#UHF-7008] Core localization file download URL is wrong (https://www.drupal.org/project/drupal/issues/3022876)": "https://git.drupalcode.org/project/drupal/-/commit/40a96136b2dfe4322338508dffa636f6cb407900.patch", "[#UHF-7008] Add multilingual support for caching basefield definitions (https://www.drupal.org/project/drupal/issues/3114824)": "https://www.drupal.org/files/issues/2020-02-20/3114824_2.patch", - "[#UHF-7008] Admin toolbar and contextual links should always be rendered in the admin language (https://www.drupal.org/project/drupal/issues/2313309)": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/5e0ae3b4033383cbca9e67f4f8047b1b515030f2/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch", + "[#UHF-7008] Admin toolbar and contextual links should always be rendered in the admin language (https://www.drupal.org/project/drupal/issues/2313309)": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/bef6ef3fd7205713749be2f4bdf63f5288a11c01/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch", "[#UHF-9388] Process translation config files for custom modules (https://www.drupal.org/i/2845437)": "https://www.drupal.org/files/issues/2023-10-16/2845437-61.patch" }, "drupal/default_content": { From e5414e7b302ccb7bffffc35965993888038fa280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 18 Dec 2023 16:55:20 +0200 Subject: [PATCH 08/27] Re-rolled drupal-2313309-render-admin-toolbar-with-admin-language.patch for drupal 10.2... again --- composer.json | 2 +- ...pal-2313309-render-admin-toolbar-with-admin-language.patch | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index f32702b6d..d1301252d 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,7 @@ "[#UHF-4325] Strip whitespaces from twig debug comments": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/b628bc051d82a1883768364050aa833824bd48c8/patches/drupal_core_strip_debug_mode_whitespaces_10.1.x.patch", "[#UHF-7008] Core localization file download URL is wrong (https://www.drupal.org/project/drupal/issues/3022876)": "https://git.drupalcode.org/project/drupal/-/commit/40a96136b2dfe4322338508dffa636f6cb407900.patch", "[#UHF-7008] Add multilingual support for caching basefield definitions (https://www.drupal.org/project/drupal/issues/3114824)": "https://www.drupal.org/files/issues/2020-02-20/3114824_2.patch", - "[#UHF-7008] Admin toolbar and contextual links should always be rendered in the admin language (https://www.drupal.org/project/drupal/issues/2313309)": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/bef6ef3fd7205713749be2f4bdf63f5288a11c01/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch", + "[#UHF-7008] Admin toolbar and contextual links should always be rendered in the admin language (https://www.drupal.org/project/drupal/issues/2313309)": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/f55f544798a75be155c1e1ebc2dcce79f33b3887/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch", "[#UHF-9388] Process translation config files for custom modules (https://www.drupal.org/i/2845437)": "https://www.drupal.org/files/issues/2023-10-16/2845437-61.patch" }, "drupal/default_content": { diff --git a/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch b/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch index b6260f67f..ea0958ff7 100644 --- a/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch +++ b/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch @@ -398,10 +398,10 @@ index 88a25d030d..b60c0163cc 100644 /** diff --git a/core/modules/language/language.services.yml b/core/modules/language/language.services.yml -index ffc267f3f5..d73b8a6e2b 100644 +index ffc267f3f5..51fc3fd65d 100644 --- a/core/modules/language/language.services.yml +++ b/core/modules/language/language.services.yml -@@ -27,3 +27,9 @@ services: +@@ -27,3 +27,6 @@ services: tags: - { name: paramconverter } lazy: true From 7de675f1f1e966cc8d932d9a85c7a7c8bc0fe21b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 18 Dec 2023 16:59:05 +0200 Subject: [PATCH 09/27] Applied the drupal-2313309-render-admin-toolbar-with-admin-language.patch... again. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d1301252d..67a989794 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,7 @@ "[#UHF-4325] Strip whitespaces from twig debug comments": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/b628bc051d82a1883768364050aa833824bd48c8/patches/drupal_core_strip_debug_mode_whitespaces_10.1.x.patch", "[#UHF-7008] Core localization file download URL is wrong (https://www.drupal.org/project/drupal/issues/3022876)": "https://git.drupalcode.org/project/drupal/-/commit/40a96136b2dfe4322338508dffa636f6cb407900.patch", "[#UHF-7008] Add multilingual support for caching basefield definitions (https://www.drupal.org/project/drupal/issues/3114824)": "https://www.drupal.org/files/issues/2020-02-20/3114824_2.patch", - "[#UHF-7008] Admin toolbar and contextual links should always be rendered in the admin language (https://www.drupal.org/project/drupal/issues/2313309)": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/f55f544798a75be155c1e1ebc2dcce79f33b3887/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch", + "[#UHF-7008] Admin toolbar and contextual links should always be rendered in the admin language (https://www.drupal.org/project/drupal/issues/2313309)": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/e5414e7b302ccb7bffffc35965993888038fa280/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch", "[#UHF-9388] Process translation config files for custom modules (https://www.drupal.org/i/2845437)": "https://www.drupal.org/files/issues/2023-10-16/2845437-61.patch" }, "drupal/default_content": { From d81cfab7a006b5b4b4fa76fcb86061431f150c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 18 Dec 2023 17:14:49 +0200 Subject: [PATCH 10/27] Re-rolled the drupal-2313309-render-admin-toolbar-with-admin-language.patch... the third time. --- ...er-admin-toolbar-with-admin-language.patch | 111 +++++------------- 1 file changed, 27 insertions(+), 84 deletions(-) diff --git a/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch b/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch index ea0958ff7..9899ad26c 100644 --- a/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch +++ b/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch @@ -16,10 +16,10 @@ index 72ff560296..9bc32c499f 100644 arguments: ['@current_user', '@user_permissions_hash_generator'] diff --git a/core/lib/Drupal/Core/Cache/Context/AccountAdminLanguageCacheContext.php b/core/lib/Drupal/Core/Cache/Context/AccountAdminLanguageCacheContext.php new file mode 100644 -index 0000000000..c827e14738 +index 0000000000..314ac18234 --- /dev/null +++ b/core/lib/Drupal/Core/Cache/Context/AccountAdminLanguageCacheContext.php -@@ -0,0 +1,53 @@ +@@ -0,0 +1,47 @@ +currentUser = $current_user; ++ public function __construct( ++ protected AccountProxyInterface $currentUser, ++ ) { + } + + /** @@ -73,19 +67,6 @@ index 0000000000..c827e14738 + } + +} -diff --git a/core/misc/cspell/dictionary.txt b/core/misc/cspell/dictionary.txt -index 8fcbd4fe32..e867034f7a 100644 ---- a/core/misc/cspell/dictionary.txt -+++ b/core/misc/cspell/dictionary.txt -@@ -287,6 +287,8 @@ endtrans - enim - enoki - entit -+entitynodedelete -+entitynodeedit - entitytype - entityviewedit - errmode diff --git a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php index 043474f072..40bb2304b3 100644 --- a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php @@ -301,7 +282,7 @@ index 0000000000..5ad1a1f096 + +} diff --git a/core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php b/core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php -index dc46bef32a..6050622ff4 100644 +index dc46bef32a..02e68eaff5 100644 --- a/core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php +++ b/core/modules/contextual/tests/src/Kernel/ContextualUnitTest.php @@ -33,10 +33,10 @@ public function contextualLinksDataProvider(): array { @@ -366,7 +347,7 @@ index dc46bef32a..6050622ff4 100644 ], ], - 'node:node=14031991:langcode=en|foo:0=bar&key=baz&1=qux:langcode=en|edge:0=20011988:langcode=en', -+ 'node:node=14031991:langcode=en|foo:0=bar&key=baz&1=qux:langcode=en|edge:0=20011988:langcode=en&admin_langcode=en', ++ 'node:node=14031991:langcode=en&admin_langcode=en|foo:0=bar&key=baz&1=qux:langcode=en&admin_langcode=en|edge:0=20011988:langcode=en&admin_langcode=en', ]; return $tests; @@ -410,57 +391,41 @@ index ffc267f3f5..51fc3fd65d 100644 + arguments: ['@language_manager', '@string_translation', '@current_user'] diff --git a/core/modules/language/src/AdminLanguageRender.php b/core/modules/language/src/AdminLanguageRender.php new file mode 100644 -index 0000000000..16d1587479 +index 0000000000..eeece9c776 --- /dev/null +++ b/core/modules/language/src/AdminLanguageRender.php -@@ -0,0 +1,131 @@ +@@ -0,0 +1,115 @@ +languageManager = $languageManager; -+ $this->translationManager = $translationManager; -+ $this->currentUser = $currentUser; ++ public function __construct( ++ protected LanguageManagerInterface $languageManager, ++ protected TranslationManager $translationManager, ++ protected AccountProxyInterface $currentUser ++ ) { + } + + /** @@ -496,7 +461,7 @@ index 0000000000..16d1587479 + * @return array + * A renderable array. + */ -+ public function switchToUserAdminLanguage(array $element) { ++ public function switchToUserAdminLanguage(array $element): array { + $userAdminLangcode = $this->currentUser->getPreferredAdminLangcode(FALSE); + + if ($userAdminLangcode && ($this->currentUser->hasPermission('access administration pages') || $this->currentUser->hasPermission('view the administration theme'))) { @@ -517,15 +482,15 @@ index 0000000000..16d1587479 + /** + * Restore original language. + * -+ * @param \Drupal\Core\Render\Markup $content ++ * @param \Drupal\Component\Render\MarkupInterface $content + * Rendered markup. + * @param array $element + * A renderable array. + * -+ * @return \Drupal\Core\Render\Markup ++ * @return \Drupal\Component\Render\MarkupInterface + * Rendered markup. + */ -+ public function restoreLanguage($content, $element) { ++ public function restoreLanguage(MarkupInterface $content, array $element): MarkupInterface { + if (isset($element['#original_langcode'])) { + $langcode = $element['#original_langcode']; + $language = $this->languageManager->getLanguage($langcode); @@ -546,25 +511,13 @@ index 0000000000..16d1587479 + +} diff --git a/core/modules/language/src/ConfigurableLanguageManager.php b/core/modules/language/src/ConfigurableLanguageManager.php -index c4187aaf60..d78a8fc331 100644 +index c4187aaf60..16c695de53 100644 --- a/core/modules/language/src/ConfigurableLanguageManager.php +++ b/core/modules/language/src/ConfigurableLanguageManager.php -@@ -235,6 +235,25 @@ public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE) { +@@ -235,6 +235,13 @@ public function getCurrentLanguage($type = LanguageInterface::TYPE_INTERFACE) { return $this->negotiatedLanguages[$type]; } -+ /** -+ * Sets current language. -+ * -+ * @param \Drupal\Core\Language\LanguageInterface $language -+ * Language interface. -+ * @param string $type -+ * Type interface. -+ */ -+ public function setCurrentLanguage(LanguageInterface $language, $type = LanguageInterface::TYPE_INTERFACE) { -+ $this->negotiatedLanguages[$type] = $language; -+ } -+ + /** + * {@inheritdoc} + */ @@ -743,16 +696,6 @@ index be99b93902..d7992fd199 100644 } } -diff --git a/core/modules/toolbar/toolbar.routing.yml b/core/modules/toolbar/toolbar.routing.yml -index 10e6cc3295..80d6d19ff2 100644 ---- a/core/modules/toolbar/toolbar.routing.yml -+++ b/core/modules/toolbar/toolbar.routing.yml -@@ -4,3 +4,5 @@ toolbar.subtrees: - _controller: '\Drupal\toolbar\Controller\ToolbarController::subtreesAjax' - requirements: - _custom_access: '\Drupal\toolbar\Controller\ToolbarController::checkSubTreeAccess' -+ options: -+ _admin_route: TRUE diff --git a/core/modules/user/src/ToolbarLinkBuilder.php b/core/modules/user/src/ToolbarLinkBuilder.php index 8d989b339e..21761a8403 100644 --- a/core/modules/user/src/ToolbarLinkBuilder.php From 3610e44f4cfdf40dd99622c571fcfc7534c871fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 18 Dec 2023 17:16:33 +0200 Subject: [PATCH 11/27] Applied the drupal-2313309-render-admin-toolbar-with-admin-language.patch... the third time. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 67a989794..262e2a360 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,7 @@ "[#UHF-4325] Strip whitespaces from twig debug comments": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/b628bc051d82a1883768364050aa833824bd48c8/patches/drupal_core_strip_debug_mode_whitespaces_10.1.x.patch", "[#UHF-7008] Core localization file download URL is wrong (https://www.drupal.org/project/drupal/issues/3022876)": "https://git.drupalcode.org/project/drupal/-/commit/40a96136b2dfe4322338508dffa636f6cb407900.patch", "[#UHF-7008] Add multilingual support for caching basefield definitions (https://www.drupal.org/project/drupal/issues/3114824)": "https://www.drupal.org/files/issues/2020-02-20/3114824_2.patch", - "[#UHF-7008] Admin toolbar and contextual links should always be rendered in the admin language (https://www.drupal.org/project/drupal/issues/2313309)": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/e5414e7b302ccb7bffffc35965993888038fa280/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch", + "[#UHF-7008] Admin toolbar and contextual links should always be rendered in the admin language (https://www.drupal.org/project/drupal/issues/2313309)": "https://raw.githubusercontent.com/City-of-Helsinki/drupal-helfi-platform-config/d81cfab7a006b5b4b4fa76fcb86061431f150c21/patches/drupal-2313309-render-admin-toolbar-with-admin-language.patch", "[#UHF-9388] Process translation config files for custom modules (https://www.drupal.org/i/2845437)": "https://www.drupal.org/files/issues/2023-10-16/2845437-61.patch" }, "drupal/default_content": { From 1c6676998e8280569694272b35402e6e287cfc75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 18 Dec 2023 17:30:08 +0200 Subject: [PATCH 12/27] Fixed error pointed out by phpstan. --- .../src/Controller/CookieConsentController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/helfi_eu_cookie_compliance/src/Controller/CookieConsentController.php b/modules/helfi_eu_cookie_compliance/src/Controller/CookieConsentController.php index 71671a5a4..5214621b7 100644 --- a/modules/helfi_eu_cookie_compliance/src/Controller/CookieConsentController.php +++ b/modules/helfi_eu_cookie_compliance/src/Controller/CookieConsentController.php @@ -9,7 +9,7 @@ /** * Defines CookieConsentController class. */ -class CookieConsentController extends ControllerBase { +final class CookieConsentController extends ControllerBase { /** * Constructs a new instance. From 1ed0e51e71a491ffc2f21c313d4c06467173b125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 18 Dec 2023 17:36:50 +0200 Subject: [PATCH 13/27] Added media_library and views as a dependency for the helfi_media_chart. --- .../helfi_media_chart/tests/src/Functional/MediaChartTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/helfi_media_chart/tests/src/Functional/MediaChartTest.php b/modules/helfi_media_chart/tests/src/Functional/MediaChartTest.php index 61299d8dc..764607bbb 100644 --- a/modules/helfi_media_chart/tests/src/Functional/MediaChartTest.php +++ b/modules/helfi_media_chart/tests/src/Functional/MediaChartTest.php @@ -24,6 +24,8 @@ class MediaChartTest extends BrowserTestBase { 'media', 'menu_ui', 'helfi_media_chart', + 'views', + 'media_library', ]; /** From 354bea7e201a9aa61d8f54360dab592abd9ac513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 18 Dec 2023 18:32:27 +0200 Subject: [PATCH 14/27] Updated views.view.media_library.yml to match D10.2 updates. --- .../helfi_media/config/rewrite/views.view.media_library.yml | 6 ++---- .../tests/src/Functional/MediaChartTest.php | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/helfi_media/config/rewrite/views.view.media_library.yml b/modules/helfi_media/config/rewrite/views.view.media_library.yml index 8234965cf..9dc873c76 100644 --- a/modules/helfi_media/config/rewrite/views.view.media_library.yml +++ b/modules/helfi_media/config/rewrite/views.view.media_library.yml @@ -1116,7 +1116,6 @@ display: default_argument_type: fixed default_argument_options: argument: '' - default_argument_skip_url: false summary_options: base_path: '' count: true @@ -1334,7 +1333,7 @@ display: image_link: '' image_style: media_library image_loading: - attribute: lazy + attribute: eager name: id: name table: media_field_data @@ -1374,7 +1373,7 @@ display: custom_date_format: '' timezone: '' tooltip: - date_format: '' + date_format: long custom_date_format: '' time_diff: enabled: false @@ -1407,7 +1406,6 @@ display: default_argument_type: fixed default_argument_options: argument: '' - default_argument_skip_url: false summary_options: base_path: '' count: true diff --git a/modules/helfi_media_chart/tests/src/Functional/MediaChartTest.php b/modules/helfi_media_chart/tests/src/Functional/MediaChartTest.php index 764607bbb..61299d8dc 100644 --- a/modules/helfi_media_chart/tests/src/Functional/MediaChartTest.php +++ b/modules/helfi_media_chart/tests/src/Functional/MediaChartTest.php @@ -24,8 +24,6 @@ class MediaChartTest extends BrowserTestBase { 'media', 'menu_ui', 'helfi_media_chart', - 'views', - 'media_library', ]; /** From 0af0323e3cb87e09ef653b596fc9c48aaca71fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 18 Dec 2023 19:34:15 +0200 Subject: [PATCH 15/27] Updated variation cache module as the 1.3 version would break DynamicPageCacheSubscriber. --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 262e2a360..4261ca575 100644 --- a/composer.json +++ b/composer.json @@ -55,6 +55,7 @@ "drupal/stomp": "^2.0", "drupal/token": "^1.9", "drupal/translatable_menu_link_uri": "^2.0", + "drupal/variationcache": "^1.4", "drupal/view_unpublished": "^1.0", "drupal/views_bulk_edit": "^2.7", "drupal/views_bulk_operations": "^4.1", From 479c4e2d3e8175910b6387a408154a5a3e823bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Tue, 19 Dec 2023 12:12:04 +0200 Subject: [PATCH 16/27] UHF-9488: Updated all views and entity view modes based on D10.2 updates. --- .../install/editor.editor.full_html.yml | 14 ++-- .../config/install/editor.editor.minimal.yml | 14 ++-- .../install/filter.format.full_html.yml | 78 +++++++++---------- .../config/install/filter.format.minimal.yml | 36 ++++----- .../rewrite/filter.format.plain_text.yml | 12 +-- .../core.entity_view_mode.media.image.yml | 1 + .../rewrite/views.view.media_library.yml | 2 +- ...ity_view_mode.media.image_content_area.yml | 1 + ...core.entity_view_mode.node.card_teaser.yml | 1 + ...re.entity_view_mode.node.medium_teaser.yml | 1 + ...core.entity_view_mode.node.tiny_teaser.yml | 1 + .../optional/language/fi/views.view.news.yml | 2 - .../optional/language/sv/views.view.news.yml | 2 - .../config/optional/views.view.news.yml | 1 - ...re.entity_view_mode.media.content_card.yml | 1 + .../core.entity_view_mode.media.hero.yml | 1 + ...e.entity_view_mode.media.list_of_links.yml | 1 + ...ity_view_mode.helfi_news.medium_teaser.yml | 1 + ...re.entity_view_mode.tpr_service.teaser.yml | 1 + ..._mode.tpr_service.teaser_search_result.yml | 1 + ...core.entity_view_mode.tpr_unit.minimal.yml | 1 + .../core.entity_view_mode.tpr_unit.teaser.yml | 1 + ...y_view_mode.tpr_unit.teaser_with_image.yml | 1 + .../core.entity_view_mode.tpr_unit.token.yml | 1 + ....entity_view_mode.tpr_unit.wide_teaser.yml | 1 + .../config/install/views.view.er_tpr_unit.yml | 1 - .../install/views.view.service_list.yml | 2 - .../install/views.view.service_units.yml | 1 - .../config/install/views.view.unit_search.yml | 1 - .../install/views.view.unit_services.yml | 1 - .../language/fi/views.view.er_tpr_unit.yml | 7 -- .../language/fi/views.view.service_list.yml | 13 ---- .../language/fi/views.view.service_units.yml | 3 - .../language/fi/views.view.unit_search.yml | 11 --- .../language/fi/views.view.unit_services.yml | 1 - .../language/sv/views.view.er_tpr_unit.yml | 8 -- .../language/sv/views.view.service_list.yml | 13 ---- .../language/sv/views.view.service_units.yml | 3 - .../language/sv/views.view.unit_search.yml | 12 --- .../language/sv/views.view.unit_services.yml | 1 - 40 files changed, 96 insertions(+), 159 deletions(-) diff --git a/modules/helfi_ckeditor/config/install/editor.editor.full_html.yml b/modules/helfi_ckeditor/config/install/editor.editor.full_html.yml index 6a94adf39..c3a19c398 100644 --- a/modules/helfi_ckeditor/config/install/editor.editor.full_html.yml +++ b/modules/helfi_ckeditor/config/install/editor.editor.full_html.yml @@ -39,6 +39,11 @@ settings: - heading4 - heading5 - heading6 + ckeditor5_list: + properties: + reversed: false + startIndex: true + multiBlock: true ckeditor5_sourceEditing: allowed_tags: - '
' @@ -57,16 +62,13 @@ settings: - '
' - '
' - '
' - ckeditor5_list: - reversed: false - startIndex: true - linkit_extension: - linkit_enabled: true - linkit_profile: helfi helfi_ckeditor_helfi_link: helfi_link_attributes: - '' - '' + linkit_extension: + linkit_enabled: true + linkit_profile: helfi image_upload: status: false scheme: public diff --git a/modules/helfi_ckeditor/config/install/editor.editor.minimal.yml b/modules/helfi_ckeditor/config/install/editor.editor.minimal.yml index 4a6be98e2..27c4467bf 100644 --- a/modules/helfi_ckeditor/config/install/editor.editor.minimal.yml +++ b/modules/helfi_ckeditor/config/install/editor.editor.minimal.yml @@ -21,22 +21,24 @@ settings: - '|' - sourceEditing plugins: + ckeditor5_list: + properties: + reversed: false + startIndex: true + multiBlock: true ckeditor5_sourceEditing: allowed_tags: - '' - '