- Issue created by @yannickoo
- Merge request !12026Issue #3522474: Fix RegEx for Icon library schema definition β (Open) created by yannickoo
- πΊπΈUnited States smustgrave
May need a test to show this bug and make sure it doesn't come back
When trying to load a library with an icon pack it seems like the regular expression for the library property schema definition is not correct and does not allow hyphens which are valid in THEME.libraries.yml
.
An IconPackConfigErrorException
exception is being thrown:
Drupal\Core\Theme\Icon\Exception\IconPackConfigErrorException: my_theme:foo Error in definition `foo`:[library] Does not match the regex pattern ^\w+/[A-Za-z]+\w*$ in Drupal\Core\Theme\Icon\Plugin\IconPackManager->validateDefinition() (line 430 of core/lib/Drupal/Core/Theme/Icon/Plugin/IconPackManager.php).
Create a new THEME.icons.yml
file in your theme and try to use -
in the library
property:
foo:
label: Foo
extractor: path
config:
sources:
- images/svgs/*.svg
library: 'my_theme/an-icon-library'
The
">regular expression for validating the library should be changed from ^\w+/[A-Za-z]+\w*$
to ^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+$
(following the RegEx from metadata.schema.json
which ensures we can use hyphens in the library name after the slash.
May need a test to show this bug and make sure it doesn't come back