Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
14 / 14 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ThemeHooks | |
100.00% |
14 / 14 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| theme | |
100.00% |
14 / 14 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Drupal\name\Hook; |
| 6 | |
| 7 | use Drupal\Core\Hook\Attribute\Hook; |
| 8 | |
| 9 | /** |
| 10 | * Hook implementations that register the module's theme definitions. |
| 11 | * |
| 12 | * @internal |
| 13 | */ |
| 14 | final class ThemeHooks { |
| 15 | |
| 16 | /** |
| 17 | * Implements hook_theme(). |
| 18 | */ |
| 19 | // phpcs:ignore Drupal.Commenting.PostStatementComment.Found -- #[Hook] is a PHP attribute, not a trailing comment. |
| 20 | #[Hook('theme')] // @phpstan-ignore attribute.notFound |
| 21 | public function theme(): array { |
| 22 | return [ |
| 23 | // Themes an individual name element. |
| 24 | 'name_item' => [ |
| 25 | 'variables' => ['item' => [], 'format' => NULL, 'settings' => []], |
| 26 | ], |
| 27 | // This themes an element into the "name et al" format. |
| 28 | 'name_item_list' => [ |
| 29 | 'variables' => ['items' => [], 'settings' => []], |
| 30 | ], |
| 31 | // Themes the FAPI element. |
| 32 | 'name' => [ |
| 33 | 'render element' => 'element', |
| 34 | ], |
| 35 | // Provides help for the recognized characters in the name_format() |
| 36 | // format parameter. |
| 37 | 'name_format_parameter_help' => [ |
| 38 | 'variables' => ['tokens' => []], |
| 39 | ], |
| 40 | ]; |
| 41 | } |
| 42 | |
| 43 | } |