Skip to content
Snippets Groups Projects
Verified Commit 4deadaa0 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3451667 by jasonawant, pooja_sharma, samit.310@gmail.com, catch,...

Issue #3451667 by jasonawant, pooja_sharma, samit.310@gmail.com, catch, longwave: AssetResolver::getCssAssets $cid does not account for ckeditor5-stylesheets variations
parent 77681bda
No related branches found
No related tags found
20 merge requests!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!9470[10.3.x-only-DO-NOT-MERGE]: #3331771 Fix file_get_contents(): Passing null to parameter,!8736Update the Documention As per the Function uses.,!8513Issue #3453786: DefaultSelection should document why values for target_bundles NULL and [] behave as they do,!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3133core/modules/system/css/components/hidden.module.css,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493
Pipeline #254236 passed with warnings
Pipeline: drupal

#254260

    Pipeline: drupal

    #254255

      Pipeline: drupal

      #254243

        ......@@ -1703,7 +1703,7 @@ services:
        Drupal\Core\Asset\LibraryDependencyResolverInterface: '@library.dependency_resolver'
        asset.resolver:
        class: Drupal\Core\Asset\AssetResolver
        arguments: ['@library.discovery', '@library.dependency_resolver', '@module_handler', '@theme.manager', '@language_manager', '@cache.data']
        arguments: ['@library.discovery', '@library.dependency_resolver', '@module_handler', '@theme.manager', '@language_manager', '@cache.data', '@theme_handler']
        Drupal\Core\Asset\AssetResolverInterface: '@asset.resolver'
        info_parser:
        class: Drupal\Core\Extension\InfoParser
        ......
        ......@@ -7,6 +7,7 @@
        use Drupal\Component\Utility\UrlHelper;
        use Drupal\Core\Cache\CacheBackendInterface;
        use Drupal\Core\Extension\ModuleHandlerInterface;
        use Drupal\Core\Extension\ThemeHandlerInterface;
        use Drupal\Core\Language\LanguageManagerInterface;
        use Drupal\Core\Language\LanguageInterface;
        use Drupal\Core\Theme\ThemeManagerInterface;
        ......@@ -58,6 +59,13 @@ class AssetResolver implements AssetResolverInterface {
        */
        protected $cache;
        /**
        * The theme handler service.
        *
        * @var \Drupal\Core\Extension\ThemeHandlerInterface
        */
        protected $themeHandler;
        /**
        * Constructs a new AssetResolver instance.
        *
        ......@@ -73,14 +81,22 @@ class AssetResolver implements AssetResolverInterface {
        * The language manager.
        * @param \Drupal\Core\Cache\CacheBackendInterface $cache
        * The cache backend.
        * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
        * The theme handler service.
        */
        public function __construct(LibraryDiscoveryInterface $library_discovery, LibraryDependencyResolverInterface $library_dependency_resolver, ModuleHandlerInterface $module_handler, ThemeManagerInterface $theme_manager, LanguageManagerInterface $language_manager, CacheBackendInterface $cache) {
        public function __construct(LibraryDiscoveryInterface $library_discovery, LibraryDependencyResolverInterface $library_dependency_resolver, ModuleHandlerInterface $module_handler, ThemeManagerInterface $theme_manager, LanguageManagerInterface $language_manager, CacheBackendInterface $cache, ?ThemeHandlerInterface $theme_handler = NULL) {
        if ($theme_handler === NULL) {
        @trigger_error('Calling ' . __METHOD__ . ' without the $theme_handler argument is deprecated in drupal:11.1.0 and it will be required in drupal:12.0.0. See https://www.drupal.org/project/drupal/issues/3451667', E_USER_DEPRECATED);
        $theme_handler = \Drupal::service('theme_handler');
        }
        $this->libraryDiscovery = $library_discovery;
        $this->libraryDependencyResolver = $library_dependency_resolver;
        $this->moduleHandler = $module_handler;
        $this->themeManager = $theme_manager;
        $this->languageManager = $language_manager;
        $this->cache = $cache;
        $this->themeHandler = $theme_handler;
        }
        /**
        ......@@ -140,10 +156,14 @@ public function getCssAssets(AttachedAssetsInterface $assets, $optimize, ?Langua
        if (!isset($language)) {
        $language = $this->languageManager->getCurrentLanguage();
        }
        $theme_info = $this->themeManager->getActiveTheme();
        // Add the theme name to the cache key since themes may implement
        // hook_library_info_alter().
        $cid = 'css:' . $theme_info->getName() . ':' . $language->getId() . Crypt::hashBase64(serialize($libraries_to_load)) . (int) $optimize;
        // Add the active theme name to the cache key since active themes may
        // implement hook_library_info_alter().
        $active_theme = $this->themeManager->getActiveTheme()->getName();
        // Add the default theme name to the cache key since css generated for an
        // active admin theme may include the default theme's ckeditor5-stylesheets
        // and default themes may be set conditionally and dynamically.
        $default_theme = $this->themeHandler->getDefault();
        $cid = 'css:' . $active_theme . ':' . $default_theme . ':' . $language->getId() . Crypt::hashBase64(serialize($libraries_to_load)) . (int) $optimize;
        if ($cached = $this->cache->get($cid)) {
        return $cached->data;
        }
        ......
        ......@@ -67,6 +67,13 @@ class AssetResolverTest extends UnitTestCase {
        */
        protected $cache;
        /**
        * The mocked theme handler.
        *
        * @var \Drupal\Core\Extension\ThemeHandlerInterface|\PHPUnit\Framework\MockObject\MockObject
        */
        protected $themeHandler;
        /**
        * A mocked English language object.
        */
        ......@@ -161,7 +168,9 @@ protected function setUp(): void {
        ->willReturn($english, $english, $japanese, $japanese);
        $this->cache = new TestMemoryBackend(new Time());
        $this->assetResolver = new AssetResolver($this->libraryDiscovery, $this->libraryDependencyResolver, $this->moduleHandler, $this->themeManager, $this->languageManager, $this->cache);
        $this->themeHandler = $this->createMock('\Drupal\Core\Extension\ThemeHandlerInterface');
        $this->assetResolver = new AssetResolver($this->libraryDiscovery, $this->libraryDependencyResolver, $this->moduleHandler, $this->themeManager, $this->languageManager, $this->cache, $this->themeHandler);
        }
        /**
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment