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.
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.
Comment | File | Size | Author |
---|---|---|---|
#6 | examples.patch | 772 bytes | droplet |
#3 | examples.patch | 730 bytes | droplet |
Comments
Comment #1
rfayI'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.
Comment #2
rfayI didn't realize these were already defined, so I'm fine with this. Patch awaited.
Comment #3
droplet CreditAttribution: droplet commentedComment #5
rfayThanks 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.
Comment #6
droplet CreditAttribution: droplet commentedthanks.
let me try, almost forgot how to create a CVS patch.
Comment #7
rfayComment #8
Dave ReidComment #9
TR CreditAttribution: TR commentedFixed. 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.
Comment #10
rfayThis 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.
Comment #11
TR CreditAttribution: TR commentedI 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