The naming of the parameter $format_id in check_markup() is quite confusing. Actually it takes the machine name of a filter format as a string.
While you could say that this machine name is indeed the ID of the filter format, a numerical ID is what would be expected. This is especially the case after in D6, the same function took a numerical ID, even though there, the parameter was simply called $format.
Confused? Mee too.
Propose to rename the parameter back to $format and to rewrite the completely uncomprehesible API documentation. How about this:
$format The machine name of the filter format to be used to filter the text. If no format is assigned, the fallback format will be used, see filter_fallback_format().
Comment | File | Size | Author |
---|---|---|---|
#22 | core-1041486-fix_misleading_parameter-22.patch | 778 bytes | cs_shadow |
#20 | core-1041486-fix_misleading_parameter-20.patch | 1.33 KB | cs_shadow |
#18 | core-1041486-fix_misleading_parameter-18.patch | 782 bytes | cs_shadow |
#12 | 1041486-12.patch | 804 bytes | lokapujya |
Comments
Comment #1
PanchoComment #2
franzA patch would be nice to this.
Comment #3
joestewart CreditAttribution: joestewart commentedJust adding a little context. This was changed in #582378: Filter System clean-up
Comment #4
sunToo minor, or someone would have patched it already.
Comment #5
PanchoThe parameter's name is in line with the rest of the API functions, so that should stay now.
However, documentation of the parameter remains misleading:
It's not "the format ID of the text" but the "ID of the text format".
Also, while it technically defaults to NULL, in this case filter_fallback_format() is used, so that should be documented.
Agree this is minor, but an quick-and-simple API doc improvement.
Comment #6
franzLooks good.
Comment #7
webchickSince this is a docs thing, sending onto jhodgdon. :)
Comment #8
jhodgdonYou cannot use @see in the middle of a documentation line. Just use the word "See".
Also that comma before @see needs to be either a period or a semi-colon (as it is, it's a comma splice of two complete sentences). And the grammar of the second sentence needs to be cleaned up -- needs "the" or "a" or something in there before "fallback".
Comment #9
jhodgdonThis should not still be assigned to me.
Comment #10
eporama CreditAttribution: eporama commentedHere is a quick patch for the doc. Changed to "Defaults to the fallback format" as the structure of "Defaults to" seems to be more common.
Comment #11
jhodgdonThanks! But this doesn't really fix the original issue that was reported here, because it doesn't make clear it's the machine name of a format, not an integer ID.
Comment #12
lokapujyaUpdated the comment.
Comment #13
srikanthk16 CreditAttribution: srikanthk16 commented**The patch is secure , since no core modifications are performed
**Theme functions/files are not altered, just documentation is changed
**no duplicate code
**Code is not altered
**Previous tests are sufficient
**provided patches are satisfying the alterations in discussion
so the issue is closed
Comment #14
sunComment #15
jhodgdonThanks for the patch! It looks fine to me.
Regarding #13 - please read the note about "issue status" that is linked to in the "issue metadata" section -- https://drupal.org/node/156119 -- issues should not be marked "Fixed" until the patch has been committed. When you review a patch, you can change the status to "needs work" or "reviewed and tested".
Also, just because a patch doesn't change code and "just" changes documentation, doesn't mean it doesn't need a review. What we'd like if you are reviewing a documentation patch is to check whether the new documentation is accurate and solves the problem of the issue. Thanks!
So, I've reviewed the patch and it looks like good documentation and solves the ambiguity that was reported here. I'll get it committed shortly, unless one of the other committers beats me to it.
Comment #16
webchickCommitted and pushed to 8.x. Thanks!
Moving down to 7.x for backport.
Comment #18
cs_shadow CreditAttribution: cs_shadow commentedAttaching patch in #12 backported to 7.x.
Comment #19
jhodgdonThere is an extra blank line in the D7 patch. Please remove. There should not be blank lines between @param sections (there should be a blank line between the end of the @param section and the @return section though).
Comment #20
cs_shadow CreditAttribution: cs_shadow commentedRemoved the extra blank line.
Comment #21
jhodgdonUh oh, that patch has a line removed in entity.inc?
Comment #22
cs_shadow CreditAttribution: cs_shadow commentedSorry. That's what happen when you forget to do a 'git checkout' before making a patch.
Comment #23
jhodgdonThanks, looks good!
Comment #24
jhodgdonThanks! Committed to 7.x.