Update examples to more better.

Visibility setting should be encouraged to use defined constants provided by block module:

BLOCK_VISIBILITY_NOTLISTED instead of 0
BLOCK_VISIBILITY_LISTED instead of 1
BLOCK_VISIBILITY_PHP instead of 2

#1045606: hook_block_info doc should use visibility constants

Thanks.

CommentFileSizeAuthor
#6 examples.patch772 bytesdroplet
#3 examples.patch730 bytesdroplet
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rfay’s picture

Status: Active » Postponed

I'm all in favor *if* and *when* #1045606: hook_block_info doc should use visibility constants goes in. I've subscribed. @droplet if you can provide a patch when that one gets committed it would be great.

I do hate that this would result in a fatal with any earlier version of D7 after we commit it.

rfay’s picture

Status: Postponed » Active

I didn't realize these were already defined, so I'm fine with this. Patch awaited.

droplet’s picture

Status: Active » Needs review
FileSize
730 bytes

Status: Needs review » Needs work

The last submitted patch, examples.patch, failed testing.

rfay’s picture

Thanks for the patch. You have to make the patch relative to root of the project directory (in the examples directory). That's why it failed to apply.

droplet’s picture

FileSize
772 bytes

thanks.
let me try, almost forgot how to create a CVS patch.

rfay’s picture

Status: Needs work » Needs review
Dave Reid’s picture

Version: » 7.x-1.x-dev
TR’s picture

Status: Needs review » Fixed

Fixed. Commit 556a3d06ac14c15bf31b5dac3399ec859de99c60

Technically, using BLOCK_VISIBILITY_LISTED adds a dependency to the Block module. Which is needed anyway if we're going to do anything with blocks, so I also added that to the dependencies in the block_example.info file.

rfay’s picture

This needs to go into 8.x too, doesn't it?

If you're not already using git cherry-pick, you'll probably want to.

Thanks for the awesome work on these.

TR’s picture

I actually did cherry pick the commit and fixed this in 8.x-1.x, I just forgot to post the D8 commit number here. (Posting commit # is a new procedure for me, I'm going to forget once in a while.)

8.x-1.x commit 17880d5a3053d81c469ca25c1a3a1fc5d8c1e000

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.