-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stops blocks that are assigned to the disabled region being rendered. #498
Conversation
… region list to visible ones. Moved list of excluded region names out of the loop and simplified vars in the loop.
Maybe want testing to confirm and approve |
So I've added a test for this change. Turns out it was pretty hard to test... There's a couple of fails showing up, but they're caused by this: localgovdrupal/localgov_project#144, not the code in this PR. |
Tests are fully green again. What do you reckon @finnlewis? |
@ekes is taking a look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll say this is makes sense. The test checks as expected.
Would to be good to know about the REGIONS_VISIBLE / 'disabled' thing though.
* We do all this because the page render runs in a different process to this | ||
* test, so we can't just read the value from the class directly. | ||
* | ||
* @dataProvider blockRegionProvider |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK so this is testing if something is rendered and something isn't rendered. That's pretty much all we need to do here. And as each run is a separate test the static value setting the header will be different and correct.
$has = 'has_' . $region; | ||
$excluded_regions = [ | ||
'messages', | ||
'disabled', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does disabled get returned with REGIONS_VISIBLE set on the request? Are there disabled not visible regions? What are they for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a theme's info.yml file, there's an optional key called 'regions_hidden', which the docs describe as 'A list of inherited regions to remove.'. If you pass the REGIONS_ALL constant to system_region_list(), these get returned. If you pass REGIONS_VISIBLE, they don't.
So my understanding of this is that it's a mechanism to allow a theme to not inherit a region from its base theme, and we shouldn't try to do anything with regions that haven't been inherited.
Added 'disabled' region to the list of regions not to render. Limited region list to visible ones. Moved list of excluded region names out of the loop and simplified vars in the loop.
Fixes #497.