I just found this on a Drupal 6 site, but it appears to be the same in Drupal 7.

To reproduce:

Enable a block.

In block configuration, select "Only the listed pages".

Leave the textarea blank.

In the database, there will be absolutely nothing in the 'pages' column for the block on saving the form, which means that instead of not showing on any pages, the block actually shows on all of them.

This would be obvious in some cases, but in the case I just found, the block was executing a view, and would only actually end up getting displayed on a very small number of pages (for example the view default arguments might not get validated, or there might not be any content).

Now it's possible to just disable the block, but I'm sure people zero out this textarea when they just don't want something rendered for a while but want to leave the position and weight etc. there for later, and it seems like a reasonable expectation that the option would actually work like this.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

agentrickard’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Novice

This condition should really be checked by block_admin_configure_validate(). That's a pretty simple patch. If path visibility is selected as BLOCK_VISIBILITY_LISTED, the option should not be empty.

barbi’s picture

Assigned: Unassigned » barbi

If the path visibility is BLOCK_VISIBILITY_LISTED, shouldn't the users be able to leave the pages textbox empty? This is the equivalent of saying - Display in no pages as of now.

agentrickard’s picture

Status: Active » Needs review
Issue tags: +Needs tests
FileSize
530 bytes

Makes sense. Needs a test. Setting to needs review for testbot.

We could also do this with a query condition, which might be a little faster?

Status: Needs review » Needs work

The last submitted patch, 1078176-block-render.patch, failed testing.

catch’s picture

Issue tags: +Needs backport to D7
franz’s picture

Status: Needs work » Needs review
FileSize
522 bytes

This was a catch.

When the user visibility was set to hidden and all other were set to visible, the new if-else clause would make it visible.

The old else clause remained on the user-visibility if clause. The new check should only disable the block in case it is BLOCK_VISIBILITY_LISTED with empty path, and not enable it otherwise.

franz’s picture

FileSize
2.52 KB

First time writing a test for core, tell me if this is ok.

Status: Needs review » Needs work

The last submitted patch, 1078176-block-render.patch, failed testing.

franz’s picture

Status: Needs work » Needs review
FileSize
2.52 KB

The block had to be moved to a region before being set to hidden, otherwise assertions on moving the block will fail.

agentrickard’s picture

Nice. One more review and RTBC.

barbi’s picture

Assigned: barbi » Unassigned
franz’s picture

bumping this.

bassthiam’s picture

Assigned: Unassigned » bassthiam

Now block aren't displayed in any page when set to "Only the listed page" with blank textarea .
tested in drupal7.

franz’s picture

Assigned: bassthiam » Unassigned
Status: Needs review » Reviewed & tested by the community

Guess this is RTBC then

Dries’s picture

Status: Reviewed & tested by the community » Fixed

This use case is a bit funny, but I guess it is the proper fix. Committed to 7.x and 8.x. Thanks!

bassthiam’s picture

Guess so

franz’s picture

Version: 8.x-dev » 6.x-dev
Status: Fixed » Patch (to be ported)
Issue tags: -Needs tests, -Needs backport to D7

Ah, as for the original issue, I guess this also applies to D6.

darrylmabini’s picture

Status: Patch (to be ported) » Needs review
franz’s picture

Why "needs review" if there is no D6 patch?

greg.harvey’s picture

Status: Needs review » Patch (to be ported)
darrylmabini’s picture

Sorry, my mistake - I accidentally clicked the re-test link.

Albert Volkman’s picture

FileSize
1.17 KB

Backported to D6.

agentrickard’s picture

@Albert Volkman

You uploaded the wrong patch.

Albert Volkman’s picture

Epic fail.

agentrickard’s picture

Status: Patch (to be ported) » Needs review

Looks good from here.

d.novikov’s picture

agentrickard’s picture

Status: Needs review » Reviewed & tested by the community
Kristen Pol’s picture

RTBC++

I applied the patch and tested that a block does not show up if Show on only the listed pages. option is selected and the Pages textarea is empty.

star-szr’s picture

Issue tags: -Novice

Removing novice tag, nothing more to be done here other than a commit.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 24: 1078176-block-render-d6-24.patch, failed testing.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.