API page: https://api.drupal.org/api/drupal/modules%21block%21block.module/functio...

block_load() looks like you can use it to load a block.

However, the query it runs doesn't filter on the theme at all, and returns the first block found.
If you have more than 1 theme on the site (eg main theme and admin theme), then each combination of module + delta is repeated for each theme.
So this means that you don't know for sure which block record you're going to get.

The documentation should state that this function does NOT get you a block record for a specific block, so its return value should not be used for anything that is theme-specific, such as the region or page visibility.

Comments

jhodgdon’s picture

Issue tags: +Novice

Agreed. Should be a decent novice project, if anyone is still working on D7 documentation.

vbouchet’s picture

Status: Active » Needs review
StatusFileSize
new512 bytes
jhodgdon’s picture

Status: Needs review » Needs work

Thanks for the patch! Pretty good... but the sentence in the patch is a "comma splice". Can you add the word "so" after the comma, to make it better English? Also take out the word "a" before "theme-specific".

vbouchet’s picture

Status: Needs work » Needs review
StatusFileSize
new513 bytes
new552 bytes

Wait! I can't imagine my English not being perfect :D
Please find the updated patch and an interdiff.

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Thanks for the patch!

jhodgdon’s picture

Thanks! Imperfect English is one reason we have patch reviews. And even native speakers sometimes write imperfectly. ;) (I personally am glad we don't have to write docs in French -- oh the pain of all those spelling rules! :) )

David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x - thanks!

I stuck the word "the" in there on commit (before "module and delta parameters") since it seemed to be missing.

  • David_Rothstein committed b100181 on 7.x
    Issue #2432619 by vbouchet, jhodgdon, joachim: block_load() should state...

Status: Fixed » Closed (fixed)

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