Comments (14)
If its hard coded in ThemeManager I can't see any easy way. A real shame as UI Patterns seems like a great way of wiring Pattern Lab and Drupal together.
from ui_patterns.
Maybe you can open an issue on PatternLab referencing this one?
from ui_patterns.
My use statement in my yml file looks like:
use: "@organisms/paragraphs/text-image/text-image.twig"
The error thrown is: Twig_Error_Loader: Template "themes/custom/ics_theme/source/_patterns/03-organisms/paragraphs/text-image/text-image.twig/text-image.twig.html.twig" is not defined
from ui_patterns.
Ha! Nice catch! .html.twig
is a Drupal thingie indeed, I'm gonna get rid of it at once! 😄
from ui_patterns.
@tanc PR created, could you please check if that works for you? Thanks!
from ui_patterns.
There must be a bit more to it as that results in the following error:
Twig_Error_Loader: Template "themes/custom/ics_theme/source/_patterns/03-organisms/paragraphs/text-image/text-image.html.twig" is not defined
For some reason the .html is still there but the directory structure is now correct.
from ui_patterns.
Yeah I guess that's not really the right fix then. Actually the .html.twig extension is kind of hardcoded in the ThemeManager class, see \Drupal\Core\Theme\ThemeManager::render()
:
}
else {
$render_function = 'twig_render_template';
$extension = '.html.twig';
// The theme engine may use a different extension and a different
// renderer.
$theme_engine = $active_theme->getEngine();
So I guess you'll have to name your templates accordantly, would that be possible?
from ui_patterns.
Ah right. That would be a shame as the name of the template is taken from the file name in Pattern Lab so file names would have html in them, like this:
from ui_patterns.
I see, any way you can override that in PatternLab?
from ui_patterns.
Yes, I can specify the file name in a .md file alongside it. The main problem is I then have to rename all my supporting files to have the .html part of the filename which is HORRIBLE!
from ui_patterns.
I wonder if there is anything I can do on my side but I guess not since anyway Drupal will try to find files with that extension, right?
from ui_patterns.
@tanc I agree that having to name files like that because of Pattern Lab is horrible! :)
I'd consider this an issue with Pattern Lab. The .html.twig
extension is advocated in Symfony/Twig documentation, so the compatibility issue is not just with Drupal/UI Patterns.
from ui_patterns.
Ahah, good feedback. There is a config setting in Pattern Lab where you can define your extension (currently twig) but there has to be a matching pattern loader rule. I don't know enough about Pattern Lab to know if this is the right direction but it could be a solution.
from ui_patterns.
Closing as follow up has been opened on PatternLab's.
from ui_patterns.
Related Issues (20)
- How to choose the variant when you use the twig "pattern" method HOT 3
- Sort patterns library alphabetically by ID on /patterns page HOT 1
- Not compatible with drupal/components v2 HOT 1
- Field Group not working HOT 1
- How to tell if in library preview mode from Twig template?
- Field group 3.x breaking change HOT 1
- PHP 8.1 compatibility HOT 4
- UI Patterns Views: Add the entity of row to pattern context
- UI Patterns Library: support UI Patterns Settings HOT 1
- Invalid argument supplied for foreach() in /var/www/html/www/modules/contrib/ui_patterns/modules/ui_patterns_library/src/Plugin/Deriver/LibraryDeriver.php on line 141
- Undefined index: label in Drupal\ui_patterns\Definition\PatternDefinitionField->__construct() (line 41 of /var/www/html/docroot/modules/contrib/ui_patterns/src/Definition/PatternDefinitionField.php) HOT 4
- It is possible to define different "preview" by "variants" ?
- Is this module still under development? HOT 1
- How to declare js trigger and element id for component behaviour? HOT 6
- Layout patterns HOT 1
- How to use an other pattern inside a pattern for the preview ? HOT 2
- Trouble with php8.1 HOT 2
- "X is not a directory" NotRegularDirectoryException after uninstalling a module HOT 2
- Warning: Undefined array key "node_title" HOT 1
- Warning: Undefined array key "label" in Drupal\ui_patterns\Definition\PatternDefinitionVariant->__construct() (line 35 of modules/contrib/ui_patterns/src/Definition/PatternDefinitionVariant.php). HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui_patterns.