File tree 2 files changed +8
-9
lines changed
src/Plugin/PatternLibrary
2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 6
6
use Drupal \Core \Config \ConfigFactoryInterface ;
7
7
use Drupal \Core \Plugin \ContainerFactoryPluginInterface ;
8
8
use Drupal \Core \State \StateInterface ;
9
+ use Drupal \patternkit \Annotation \PatternLibrary ;
9
10
use Drupal \patternkit \JSONSchemaEditorTrait ;
10
11
use Drupal \patternkit \Pattern ;
11
12
use Drupal \patternkit \PatternEditorConfig ;
24
25
class PatternLibraryJSON extends PatternLibraryPluginDefault implements ContainerFactoryPluginInterface {
25
26
use JSONSchemaEditorTrait;
26
27
27
- /**
28
- * State machine service.
29
- *
30
- * @var \Drupal\Core\State\StateInterface
31
- */
32
- protected $ state ;
33
-
34
28
/**
35
29
* Attaches services.
36
30
*
Original file line number Diff line number Diff line change @@ -83,8 +83,13 @@ public function render(array $assets): array {
83
83
$ bare = basename ($ file );
84
84
/** @var \Drupal\Core\Template\TwigEnvironment $twig */
85
85
$ twig = \Drupal::service ('twig ' );
86
- $ template = $ twig ->load ("$ namespace/ $ pattern ->filename " );
87
- $ elements [] = $ template ->render ($ pattern ->config ?? []);
86
+ try {
87
+ $ template = $ twig ->load ("$ namespace/ $ pattern ->filename " );
88
+ $ elements [] = $ template ->render ($ pattern ->config ?? []);
89
+ }
90
+ catch (\Exception $ exception ) {
91
+ // @todo Use twig logger and log this exception.
92
+ }
88
93
}
89
94
return $ elements ;
90
95
}
You can’t perform that action at this time.
0 commit comments