Linked Questions

96
votes
7answers
14k views

What are the downsides of using PHP Filter code in blocks, nodes, views-args, etc?

I have seen many times people saying not to use custom PHP/PHP filter (from the Drupal UI) in blocks, nodes, views-args, rules, etc. I have searched around a bit and haven't found much, it seems like ...
11
votes
2answers
5k views

Is there a way to set block visibility programmatically without using the PHP Filter module?

By enabling the core PHP Filter module, I can use PHP code to set the visibility of a block in the block configure page. But I don't want to enable the PHP filter module for security measure. So is ...
6
votes
6answers
3k views

How to display a block on only the listed pages using wildcard and excluding subpages?

I have a block I'm displaying using block setting's "Only the listed pages". I'm using a wild card asterisk to show the block on any pages following about-us/. For example: about-us/* The problem is ...
5
votes
4answers
4k views

How can I show a block in a view page, excluding its paginated pages?

I want to place put a block in a view page. Let's say the news page, whose path is http://www.example.com/news. The view uses pager to list the content. I want a block to show up only in the ...
4
votes
4answers
2k views

How to show block on pages with URLs containing a question mark ( 'searchquery' )?

For example I end up with url's like example.com/viewname?f=[0]field_name=%3A21 I want to make a block visible on pages like the above but not when only the view is displayed. Only the view will ...
4
votes
3answers
5k views

How to show a block on pages with url parameters?

I have a block that I want to show on pages matching news and news?page=1. In the 'only show on these pages' section I have news and news/* but it doesn't match the second url. Is there a way to do ...
1
vote
3answers
3k views

How can I show a block on a specific page if a custom PHP function evaluates to be true?

Follow-up to the question "How can I show a single block only if the user is on iOS?". I am using D7 and trying to show a message to iOS users that their devices of choice do not support basic upload ...
3
votes
3answers
2k views

How to show a block on the user profile page but not the user edit page?

I have added a block to a region and set it so that it shows on user profile pages. However, I want the block to be displayed only on the profile pages, not on the profile edit pages. Is that ...
4
votes
3answers
624 views

Does the Context module check block visibility settings?

I am using Drupal 7.14 and the Context module (7.x-3.0-beta4). I set block visibility settings and the Context module doesn't seems to be checking them before rendering. Only context conditions are ...
1
vote
5answers
733 views

How to show/hide a block at some content types using PHP filter?

I want to show/hide my block at some content types so I'm using PHP filter. My code in block configuration is: <?php if(arg(0)=='eshop') { return true; } if(arg(0)=='node' && is_numeric(...
3
votes
3answers
508 views

How to display a block for pages that don't show nodes?

My Drupal 7 module creates a block, and then in admin I can make it available for the Article content type only. I would also like it to be available to the result page for a Product Search. This page ...
2
votes
2answers
623 views

How to show blocks by url, when nodes have multiple paths?

I know that having multiple path aliases to a single node is discouraged, but it is a situation I have to deal with. My node is accessible via /news/node-1, /baseball/news/node-1 and /basketball/news/...
3
votes
3answers
450 views

How to display blocks as a toggle?

I am displaying a list of Views blocks on the user page. I want to create a menu/list of links on the sidebar of the page, and when I click the link "Block 1" it shows only the "Block 1". When I ...
2
votes
3answers
723 views

How to show a block on a set of subpages except one of them?

I have a block which is shown on all subpages under "mypagename", using the following bmock visibility settings: Only the listed pages --> mypagename/* Except I now need to exclude one page ...
1
vote
3answers
1k views

How to display a block if a Boolean on/off checkbox is checked?

I will eventually install Panels to accomplish this. But I can't at this time. I want to allow an editor to display a right sidebar menu on any page when they want by checking a Single on/off checkbox ...

15 30 50 per page