Problem/Motivation
In a use case where there are multiple frontend enviroments where some of them are inactive (status=0) it would be nice to only show active ones in the toolbar.
Inactivity of some frontend environments can be, in example, due to different deployment environments.
Steps to reproduce
Add and configure multiple frontend environments.
Set the status of one of them to 0 (via config of settings.php)
The environment is still shown in the toolbar.
Proposed resolution
In the hook_toolbar, check if the environment status is 1 before adding it to toolbar.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 3219055-9.patch | 2.19 KB | petar_basic |
| #8 | 3219055-8.patch | 2.04 KB | larowlan |
| #8 | 3219055-interdiff-8.txt | 533 bytes | larowlan |
Comments
Comment #2
petar_basic commentedHere is a patch that adds checks for environment status before adding it to toolbar.
Comment #3
petar_basic commentedChanging the name of the patch.
Comment #4
larowlanWe need to return the #cache here so that the item can be invalidated properly.
So perhaps we just return the empty cache item.
Can you add a new test for this, see
\Drupal\Tests\build_hooks\Functional\UiTest::assertToolbarIntegrationFor an example.
The test should disable the env, make sure the button isn't there, then re-enable it.
Comment #5
petar_basic commentedI improved the patch so it only looks for environments with status true instead of having multiple if-s.
Added a test that checks if an active environment is shown in the toolbar and that an inactive one is not shown.
Comment #6
petar_basic commentedComment #7
larowlanWe need to call this method from one of the `test{Something}` methods in order for it to be run
Comment #8
larowlanComment #10
petar_basic commentedSeems like the entity has to be saved after change. And the test should be run before the last one.
Comment #11
petar_basic commentedComment #13
larowlanThanks, cutting 3.2.1 with this in it
Comment #14
larowlanhttps://www.drupal.org/project/build_hooks/releases/3.2.1