From 9d75e740c6585f55b7c937013bfc87e8dc2afae9 Mon Sep 17 00:00:00 2001
From: bnjmnm <benm@umich.edu>
Date: Fri, 12 Nov 2021 09:03:34 -0500
Subject: [PATCH] Issue #3247650 by Sutharsan, larowlan: Make it clear that
 hook_page_attachments is not called in themes

---
 core/lib/Drupal/Core/Render/theme.api.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/core/lib/Drupal/Core/Render/theme.api.php b/core/lib/Drupal/Core/Render/theme.api.php
index 778e48524e75..584ab733278b 100644
--- a/core/lib/Drupal/Core/Render/theme.api.php
+++ b/core/lib/Drupal/Core/Render/theme.api.php
@@ -1041,7 +1041,8 @@ function hook_css_alter(&$css, \Drupal\Core\Asset\AttachedAssetsInterface $asset
 /**
  * Add attachments (typically assets) to a page before it is rendered.
  *
- * Use this hook when you want to conditionally add attachments to a page.
+ * Use this hook when you want to conditionally add attachments to a page. This
+ * hook can only be implemented by modules.
  *
  * If you want to alter the attachments added by other modules or if your module
  * depends on the elements of other modules, use hook_page_attachments_alter()
@@ -1070,7 +1071,8 @@ function hook_page_attachments(array &$attachments) {
  *
  * Use this hook when you want to remove or alter attachments on the page, or
  * add attachments to the page that depend on another module's attachments (this
- * hook runs after hook_page_attachments().
+ * hook runs after hook_page_attachments(). This hook can be implemented by both
+ * modules and themes.
  *
  * If you try to add anything but #attached and #cache to the array, an
  * exception is thrown.
-- 
GitLab