Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a block that I want to show to the end user on all nodes:
So I enter:
node/* as the path to allow the block to be visible thereHowever I *do not* want the block to be displayed when I create a node. The path will be something like node/add/story. This matches node/* unfortunately.
Answer:
// Only show on true node VIEW pages. Not node/add or node/n/edit etc
return (arg(0)=='node' && is_numeric(arg(1)) && (!arg(2)));
Comments
Doesn't work for node/%/view
Doesn't work for node/%/view ...
Try This :-)
Change user to node and you should have the same effect.
Let me know if it works.
This looks like it works!
Thank you for this ... it appears to work fine.
Very nice! This is a great
Very nice! This is a great catch-all snippet that can also be used in Context (+ Context PHP). I know - code in db = big frowny face. Only in VERY limited circumstances. ;)
for node/%/view and block admin
The following will return TRUE on node/%, node/%/view, admin/(build)/block*