Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294542

LibraryDiscoveryParser need to check Theme exist similar to Module

$
0
0

Problem/Motivation

Non-existing attachment declarations in Twig file throwing Warning error.

    if ($extension === 'core') {
      $path = 'core';
      $extension_type = 'core';
    }
    else {
      if ($this->moduleHandler->moduleExists($extension)) {
        $extension_type = 'module';
      }
      else {
        $extension_type = 'theme';
      }
      $path = $this->extensionPathResolver->getPath($extension_type, $extension);
    }

If the given extension name does not exist in the Twig library, that is considered as Theme instead of checking whether the library extension exists.

Steps to reproduce

1. Create a custom Sample module(sample.module) in a fresh Drupal site.
2. Add hook_theme and create a custom render template.
3. Inside the TWIG attach non existing library as below.
{{ attach_library('xyz_module/xy_library') }}

Proposed resolution

As same as moduleExists() check need to implement for the $this->themeHandler->themeExists($extension)

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 294542


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>