- Issue created by @skyriter
- πΊπΈUnited States skyriter
The top of the page alert message shows only when the block module is not enabled, per the sitewide_alert.module file:
/** * Implements hook_page_top(). */ function sitewide_alert_page_top(array &$page_top): void { // Bail out if block submodule is enabled. if (\Drupal::service('module_handler')->moduleExists('sitewide_alert_block')) { return; } $page_top['sitewide_alert'] = \Drupal::service('sitewide_alert.sitewide_alert_renderer')->build(); }
To have the same functionality, we'll need to replicate this in the
uswds_alert.module
file.The block module itself only creates a block, as it has 2 files:
-sitewide_alert/modules/sitewide_alert_block/src/Plugin/Block/SitewideAlertBlock.php
-sitewide_alert/modules/sitewide_alert_block/sitewide_alert_block.info.yml
There's nothing here that Drupal itself doesn't provide.
My recommendation is not to require the
sitewide_alert_block
submodule as a dependency. - πΊπΈUnited States swirt Florida
That lives in the base module. Can we override it by putting it in our module. ( I would not think so, but I have no proof)
- πΊπΈUnited States swirt Florida
Looks like maybe we could just implement this hook and then unset
$page_top['sitewide_alert']
- πΊπΈUnited States swirt Florida
Probably want to force the module weight to make sure this fires AFTER sitewide_alert
https://www.drupal.org/docs/develop/creating-modules/understanding-hooks... β - πΊπΈUnited States skyriter
We sure can. It should already, based on the name, as they fire alphabetically if the weight's not been changed, but we can can also put our thumbs on the scale for good measure (although wouldn't that actually be "bad" measure)?