From b366dfb9b562e9008157ab1c1e18531847f6304e Mon Sep 17 00:00:00 2001 From: catch <6915-catch@users.noreply.drupalcode.org> Date: Fri, 10 Jan 2025 12:05:27 +0000 Subject: [PATCH] Issue #3498073 by nicxvan: Manually convert unversioned_assets_test_library_info_alter --- .../src/Hook/UnversionedAssetsTestHooks.php | 27 +++++++++++++++++++ .../unversioned_assets_test.module | 20 -------------- 2 files changed, 27 insertions(+), 20 deletions(-) create mode 100644 core/modules/system/tests/modules/unversioned_assets_test/src/Hook/UnversionedAssetsTestHooks.php delete mode 100644 core/modules/system/tests/modules/unversioned_assets_test/unversioned_assets_test.module diff --git a/core/modules/system/tests/modules/unversioned_assets_test/src/Hook/UnversionedAssetsTestHooks.php b/core/modules/system/tests/modules/unversioned_assets_test/src/Hook/UnversionedAssetsTestHooks.php new file mode 100644 index 000000000000..7bc2237f694c --- /dev/null +++ b/core/modules/system/tests/modules/unversioned_assets_test/src/Hook/UnversionedAssetsTestHooks.php @@ -0,0 +1,27 @@ +<?php + +declare(strict_types=1); + +namespace Drupal\unversioned_assets_test\Hook; + +use Drupal\Core\Hook\Attribute\Hook; + +/** + * Hook implementations for unversioned_assets_test. + */ +class UnversionedAssetsTestHooks { + + /** + * Implements hook_library_info_alter(). + */ + #[Hook('library_info_alter')] + public function libraryInfoAlter(&$libraries, $extension): void { + if ($extension === 'system') { + // Remove the version and provide an additional CSS file we can alter the + // contents of . + unset($libraries['base']['version']); + $libraries['base']['css']['component']['public://test.css'] = ['weight' => -10]; + } + } + +} diff --git a/core/modules/system/tests/modules/unversioned_assets_test/unversioned_assets_test.module b/core/modules/system/tests/modules/unversioned_assets_test/unversioned_assets_test.module deleted file mode 100644 index 89d46002e97e..000000000000 --- a/core/modules/system/tests/modules/unversioned_assets_test/unversioned_assets_test.module +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -/** - * @file - * Helper module for unversioned asset test. - */ - -declare(strict_types=1); - -/** - * Implements hook_library_info_build(). - */ -function unversioned_assets_test_library_info_alter(&$libraries, $extension): void { - if ($extension === 'system') { - // Remove the version and provide an additional CSS file we can alter the - // contents of . - unset($libraries['base']['version']); - $libraries['base']['css']['component']['public://test.css'] = ['weight' => -10]; - } -} -- GitLab