Lines: 100.00%
| Line | Hits | Source |
|---|---|---|
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Drupal\visitors\Hook; | |
| 6 | ||
| 7 | use Drupal\Core\Hook\Attribute\Hook; | |
| 8 | use Drupal\visitors\VisitorsPageAttachmentsInterface; | |
| 9 | ||
| 10 | /** | |
| 11 | * Implements hook_page_attachments() and hook_page_bottom(). | |
| 12 | */ | |
| 13 | class PageAttachmentsHooks { | |
| 14 | ||
| 15 | /** | |
| 16 | * Constructs a PageAttachmentsHooks object. | |
| 17 | * | |
| 18 | * @param \Drupal\visitors\VisitorsPageAttachmentsInterface $pageAttachments | |
| 19 | * The page attachments service. | |
| 20 | */ | |
| 21 | public function __construct( | |
| 22 | protected VisitorsPageAttachmentsInterface $pageAttachments, | |
| 23 | 2 | ) {} |
| 24 | ||
| 25 | /** | |
| 26 | * Implements hook_page_attachments(). | |
| 27 | */ | |
| 28 | #[Hook('page_attachments')] | |
| 29 | public function pageAttachments(array &$page) { | |
| 30 | 1 | $this->pageAttachments->pageAttachments($page); |
| 31 | } | |
| 32 | ||
| 33 | /** | |
| 34 | * Implements hook_page_bottom(). | |
| 35 | */ | |
| 36 | #[Hook('page_bottom')] | |
| 37 | public function pageBottom(array &$page_bottom): void { | |
| 38 | 1 | $this->pageAttachments->pageBottom($page_bottom); |
| 39 | } | |
| 40 | ||
| 41 | } |