Conditions | 6 |
Paths | 7 |
Total Lines | 35 |
Lines | 22 |
Ratio | 62.86 % |
Changes | 0 |
1 | <?php |
||
8 | function graphql_twig_theme($existing, $type, $theme, $path) { |
||
9 | /** @var \Drupal\Core\Extension\ThemeHandlerInterface $themeHandler */ |
||
10 | $themeHandler = \Drupal::service('theme_handler'); |
||
11 | $theme = []; |
||
12 | foreach ($themeHandler->listInfo() as $themeName => $info) { |
||
13 | |||
14 | // Register twig routes as theme hooks. |
||
15 | View Code Duplication | if (isset($info->info['routes'])) { |
|
16 | foreach ($info->info['routes'] as $name => $route) { |
||
17 | $theme[$name] = [ |
||
18 | 'variables' => [ |
||
19 | 'graphql_arguments' => [], |
||
20 | 'graphql_ext' => $name, |
||
21 | ], |
||
22 | 'function' => '_graphql_twig_missing_template', |
||
23 | ]; |
||
24 | } |
||
25 | } |
||
26 | |||
27 | // Register twig blocks as theme hooks. |
||
28 | View Code Duplication | if (isset($info->info['blocks'])) { |
|
29 | foreach ($info->info['blocks'] as $name => $block) { |
||
30 | $theme[$name] = [ |
||
31 | 'variables' => [ |
||
32 | 'graphql_arguments' => [], |
||
33 | 'graphql_ext' => $name, |
||
34 | ], |
||
35 | 'function' => '_graphql_twig_missing_template', |
||
36 | ]; |
||
37 | } |
||
38 | } |
||
39 | |||
40 | } |
||
41 | return $theme; |
||
42 | } |
||
43 | |||
52 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.