API page: http://api.drupal.org/api/drupal/modules%21block%21block.api.php/functio...
Even though pages is documented as "a list of pages", it should not be an array, but a single string with the paths separated by "\n". This should be documented.
| Comment | File | Size | Author |
|---|---|---|---|
| #38 | drupal-api-doc-1500160-38.patch | 1.21 KB | jmarkel |
| #35 | drupal-api-doc-1500160-35.patch | 1.21 KB | jmarkel |
| #33 | drupal-api-doc-1500160-33.patch | 1.2 KB | jmarkel |
| #25 | drupal-api-doc-1500160-25.patch | 6.63 KB | jmarkel |
| #21 | drupal-api-doc-1500160-21.patch | 5.97 KB | tstoeckler |
Comments
Comment #1
jhodgdonSounds like a good thing to document. Documentation of 'pages' should probably say that it can be a string with the paths, or PHP code, depending on the value of 'visibility'.
And while we're at it, this whole doc block's list formatting could be updated to current standards (not using '' around the array element names):
http://drupal.org/node/1354#lists
Comment #2
jmarkel commentedI made the suggested changes (for 'pages' and for the array element names).
Here are two patches - one for 8.x and one for 7.x
It's my first core patch (doc or otherwise) - please be gentle with me :-)
Comment #4
jmarkel commentedGuess I needed to open a separate issue for 7.x - will do so
Comment #5
jmarkel commentedComment #6
tstoecklerThat really pretty good, I think.
One thing that I think could be added, is the information that the custom PHP code should return TRUE or FALSE depending on whether the block should be shown.
Comment #7
jmarkel commentedI'll make that change (for PHP code) and re-roll the patch.
I've also opened #1503614: Document the 'pages' key in hook_block_info() for the 7.x backport.
Comment #8
jmarkel commentedHere's the update with the PHP code addition
Comment #9
jmarkel commentedDang it. Typo - fixed
Comment #10
tstoecklerTrailing whitespace.
Also, I just re-read the docs for drupal_match_path() and found:
So not only \n is supported. Should we document all three options?
Comment #11
jmarkel commentedSo we should :-)
Comment #12
jhodgdonThe docs look good! A minor grammatical nitpick: "which" should be "that" (in "A string which contains one or...") (bonus points if you fix which/that in the text above too -- you use "which" only if it's after a comma).
Also, I think we should also document here that you can use * as a wildcard in the paths?
Comment #13
jmarkel commentedIt's a good nit to pick, though also one that I often ignore - but 'which' and 'that' do have different use cases, which are worth remembering.
Comment #14
tstoecklerAwesome!
Setting to RTBC. This is on jhodgdon's plate, so if there's something wrong that I missed she can set it back to "needs work".
Comment #15
jhodgdonMuch better... Still a little concerned about wording:
How about just this for that sentence:
Paths may use * as a wildcard (matching any number of characters); designates the site's front page.
Comment #16
jmarkel commentedGotcha. And done...
Comment #17
tstoecklerI re-read the whole patch and found some wrapping issues. :(
So sadly have to mark needs work again.
I think this wraps early now. (I am always unsure about 80 vs. 81 chars, so this might be incorrect.)
These all wrap early.
Comment #18
jmarkel commentedWhy is wrapping < 80 a problem? No lines are > 80; neither are any abnormally short or broken at odd places.
Comment #19
jhodgdonEverything should wrap as close to 80 characters as possible (including leading white space).
http://drupal.org/node/1354#general (last bullet point in that section)
Comment #20
jmarkel commentedOkay, thanks. Try this one - I think everything is wrapped as near to 80 as I could get it.
Comment #21
tstoecklerTrailing whitespace.
Fixed that one myself. That is the only thing I changed, so I'll have the audacity to mark my own patch RTBC.
Comment #22
jmarkel commentedGrrr - annoys me that I missed that. Thanks, tstoeckler. This is good to go now, I trust :-)
Comment #23
jhodgdonCommitted to 8.x. Thanks!!
Apparently needs to be rerolled before it will apply to 7.x.
Comment #24
jmarkel commentedNo prob - will do it later on today.
Comment #25
jmarkel commentedre-rolled for 7.x
Comment #26
rmalcome commentedComment #27
rmalcome commentedRTBC at 3/28 Long beach Drupal LA meetup
works well
Comment #28
rmalcome commentedComment #29
jhodgdonThanks - committed to 7.x.
Comment #30
tstoecklerWell I guess this should be backported to D6 as well.
The code is a little different, but basically the same:
http://api.drupal.org/api/drupal/developer!hooks!core.php/function/hook_...
I don't know if it's worth it, though (since hooks aren't documented in-code in D6), so leaving at fixed.
Comment #31
tstoecklerJust realized my post was a little schizophrenic.
So marking needs work.
If you don't think this is worth it, feel free to revert to fixed.
Comment #32
jhodgdonThe docs are in code in D6, just not in Drupal Core. Moving to Documentation project (that is where the files are, in the Documentation project git repo, under developer/hooks). Patch welcome. :)
Comment #33
jmarkel commentedHere's a patch for 6.x. I only made the changes to document 'pages.' I made no attempt to backport the other changes in 7.x and 8.x
Comment #34
jhodgdonThe indentation is not correct there, but other than that it looks fine, and I agree with the idea of only fixing the 'pages' documentation.
Comment #35
jmarkel commentedWhen you're right, you're right.
Here's another patch...
Comment #36
jmarkel commentedComment #37
tstoecklerPHPcode -> PHP code
Otherwise RTBC
Comment #38
jmarkel commentedComment #39
tstoecklerRTBC, me thinks. Awesome!
Comment #40
kristen polI read through the documentation in #38 (for 'pages') and it is clear to me but I don't know where to apply the patch.
Comment #41
kristen polDidn't mean to put it back to active.
Comment #42
jmarkel commentedIt took me a little while to find it - it's part of the Documentation project
Comment #43
jhodgdonYes, Documentation project (hence why this issue was moved to that project. :) ).
Thanks! I've committed this to the D6 docs project. Moving issue back to core for posterity.