- 🇳🇱Netherlands basvredeling Amsterdam
This patch works well but would be more in line with the current Drupal block visibility conditions if it were stated as radio buttons saying "Show for..." / "Hide for..." like we do on the path / pages block condition.
- 🇱🇹Lithuania eugis
@basvredeling, this works for my cases (just ignore the MissingValueContextException if the condition is negated).
- 🇺🇸United States wmcmillian-coalmarch
Re-rolled #15 ✨ Add support for negating node type(content type) condition for block visibility Needs work for 10.2.1 and incorporated #20 ✨ Add support for negating node type(content type) condition for block visibility Needs work
- last update
about 1 year ago 25,754 pass, 1,846 fail - last update
about 1 year ago Build Successful - last update
12 months ago Build Successful - 🇺🇸United States dswier
I am working on an upgrade from 9.5 to 10.2, and previously we had been using the patch in #8 that now doesn't apply. Trying out #21, we discovered that blocks we had been using this negate condition on were showing up again where they shouldn't be. I am not familiar enough with core code to understand what patch #20 is doing, but I found that reverting just those changes brought back the behavior we were expecting. I'm attaching a patch without those changes. If the code in #20 is still necessary, I'd be glad to help with any changes, but first I would need some help understanding what it is supposed to be doing.
- last update
9 months ago Patch Failed to Apply - 🇺🇸United States sonfd Portland, ME
Really just reiterating notes made in #11.
In my testing with patch #22, i.e. if we just remove
entity_bundle:node
from the$disable_negation
array, it works as expected for nodes, but it adds a secret restriction of also only limiting the block to nodes.For example, if I have a block and the only visibility rules I apply are to:
- Select Content type: Page
- Select "Negate the condition"
This removes the page title block from my Page nodes, however it also removes the page title block from any non-node page. I suspect this may be why this is not allowed without a patch here.
I thought maybe I could add an additional condition, to show on Pages matching
/*
, but it seems that it does not - it still does not show on non-node pages, e.g. user login or view pages. - 🇺🇸United States sonfd Portland, ME
I think this is related? blocked by? https://www.drupal.org/project/drupal/issues/2823432 🐛 Node Type / Entity bundle conditions evaluation is wrong when context is not provided Needs work
- 🇺🇸United States sonfd Portland, ME
Also noting that the Block Visibility Conditions → module provides a specific "Not Content Type" filter that works as expected.
- 🇳🇱Netherlands timohuisman Leiden, Netherlands
The patch from #22 seems to work with the MR from 🐛 Node Type / Entity bundle conditions evaluation is wrong when context is not provided Needs work .
I've added a condition to the page title block so its only visible on "Articles", visited the 404 route and still saw the page title. Without the MR from 2823432 the page title was hidden.
- 🇮🇳India junaidpv Kannur, Kerala
@sonfd Thank you!
The "Block Visibility Conditions" module is very appropriate here rather than trying to "fix" patch here.