2

How can I configure block visibility to show only in node view pages? (not in node edit and create pages)

What should I insert in "Show block on specific pages" > "Only the listed pages"? current config is:

video
node/*
3
  • Use contenttypes instead of pages. Then select all contentypes.
    – Puyol
    Jun 20, 2012 at 10:01
  • and what about video page? which is a list of videos created in views Jun 20, 2012 at 10:16
  • Make a block of the view and display it on a page?
    – Puyol
    Jun 20, 2012 at 10:38

3 Answers 3

4

Use this in your block configurations page "Show block on specific pages" > "Show if the following PHP code returns TRUE"

if(arg(0) == 'node' && is_numeric(arg(1)) && ((arg(2) == "" || arg(2) == 'view'))) {
  return TRUE;
}

Hope this will help.

You will need to enable the core module PHP.

1
4

I use the Context Module for this. It allows a more fine grained control than the out-of-the-box drupal-options.

1
  • +1 Context is definitely the best suited for this type of thing. Only thing with Context at the moment is it can't handle "Block Configurations" per context, you need to configure the block from the block admin screen.
    – Beebee
    Jun 29, 2012 at 12:21
1

Select the block you wish to exclude and add '/edit' and '/add/*' to the 'Pages' tab in the 'Visibility settings'. You can use 'Content types' in combination with these settings to fine tune a bit further. edit/add

1
  • This one is one is the best answer, it is simple and does require additional modules like PHP or Context. Mar 18, 2022 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.