Skip to content

Commit 3b9d745

Browse files
committed
Added show_on_all_pages option
1 parent 181cafd commit 3b9d745

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
* [PR-7](https://github.com/itk-dev/drupal_admin_message/pull/7)
11+
Added `show_on_all_pages` option
1012
* [PR-6](https://github.com/itk-dev/drupal_admin_message/pull/6)
1113
Added version matrix
1214

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ $settings['drupal_admin_message']['css']['background-color'] = 'orange';
3333
$settings['drupal_admin_message']['css']['color'] = 'white;';
3434
```
3535

36+
The message can optionally be shown on _all_ pages:
37+
38+
```php
39+
# settings.local.php
40+
$settings['drupal_admin_message']['show_on_all_pages'] = TRUE;
41+
```
42+
3643
## Coding standards
3744

3845
```shell

src/EventSubscriber/ResponseSubscriber.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ public function onResponse(ResponseEvent $event): void {
4444
* Get message.
4545
*/
4646
private function getMessage(): ?string {
47-
if ($this->adminContext->isAdminRoute()) {
48-
$settings = Settings::get('drupal_admin_message');
47+
$settings = Settings::get('drupal_admin_message');
48+
49+
if ($this->adminContext->isAdminRoute() || ($settings['show_on_all_pages'] ?? FALSE)) {
4950
$blocks = array_filter((array) ($settings['blocks'] ?? NULL));
5051

5152
if (!empty($blocks)) {

0 commit comments

Comments
 (0)