Closed (outdated)
Project:
Drupal core
Version:
8.8.x-dev
Component:
documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
3 Oct 2012 at 22:11 UTC
Updated:
9 Jun 2020 at 06:23 UTC
Jump to comment: Most recent
Comments
Comment #1
jhodgdonI don't think anyone would argue with this principle, or with clarifying hook documentation in this way.
But this issue is not really actionable as it is... What hooks specifically do you think need more documentation in this regard?
Comment #2
David_Rothstein commentedThis was discussed a bit in the Drupal Security Team before we concluded it was essentially a documentation issue and therefore decided it was OK to file publicly. The example that @Tor Arne Thune brought up in the private discussion originally was hook_verify_update_archive(), which is expected to return already-sanitized strings (which are then printed as-is to the page). I then brought up hook_permission() which is another example of the same thing.
Right at this moment, and off the top of my head, and I can't think of any examples of hooks where this is not the case, except for things like hook_menu() where you don't even translate the string either.
Maybe in core it's the case that whenever your code is supposed to return a translated string, it's also supposed to sanitize it for use in HTML, and otherwise it's not? If so, we could use that as a basis for documentation.
Comment #3
jhodgdonOK. Some of the hooks we have are already documented with "this should be translated", etc. Some are probably not... Anyway, a patch would be good, or even a careful inventory of what needs to be documented would help.
Comment #11
pameeela commentedAs part of the Bug smash initiative, we are triaging issues that are marked 'Postponed (maintainer needs more info)'. This issue is no longer relevant so I am marking it 'Closed (outdated)'.