File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -98,10 +98,23 @@ function patternkit_pattern_libraries() {
9898function patternkit_patternkit_library() {
9999 $libraries = array();
100100
101+ // Load patterns from this module for testing.
101102 $module_path = drupal_get_path('module', 'patternkit');
102103 $lib_path = $module_path . DIRECTORY_SEPARATOR . 'lib';
103104 $libraries[] = new PatternkitDrupalTwigLib('Example', $lib_path);
104105
106+ // Load patterns from themes exposing namespaces.
107+ foreach (list_themes() as $theme_name => $theme) {
108+ if ($theme->engine !== 'twig' || !isset($theme->info['namespaces'])) {
109+ continue;
110+ }
111+ foreach ($theme->info['namespaces'] as $namespace => $path) {
112+ $theme_path = dirname($theme->filename);
113+ $lib_path = $theme_path . DIRECTORY_SEPARATOR . $path;
114+ $libraries[] = new PatternkitDrupalTwigLib($namespace, $lib_path);
115+ }
116+ }
117+
105118 return $libraries;
106119}
107120
Original file line number Diff line number Diff line change 11<?php
22/**
33 * @file
4- * customer-portal-kbase-copy
5- *
6- * - Created by jassmith on 2/2/18
4+ * Patternkit module - Twig wrapper.
75 */
86
7+ /**
8+ * Class PatternkitTwigWrapper.
9+ */
910class PatternkitTwigWrapper {
1011
1112 protected $ metadata ;
You can’t perform that action at this time.
0 commit comments