Problem/Motivation
See #1183042-70: Regression: Add WAI-ARIA roles to Core blocks and the next few comments that follow it. (@todo: It would be good to summarize those points here.)
Proposed resolution
One of the following:
- Use hook_block_view(). This would rely on #1302482: Ensure render arrays properly handle #attributes and add them there instead of preprocess hooks and the modules would add the WAI-ARIA attributes directly.
- Classify blocks in hook_block_info(), so that the metadata is available in the correct place, and then have template_preprocess_block() add the WAI-ARIA attributes based on that. This would be straightforward also, except the hook_block_info() 'properties' element is currently not stored in the database so it's not available when a block is loaded. We might need to put it in the database for this to work. That's probably a good idea anyway, since currently almost everything in hook_block_info() lives in the database, and it's inconsistent that this one isn't.
- Do nothing, as per #1, since "We use preprocess functions to add attributes all over the place in core."
Remaining tasks
- When this issue is resolved, update the change notification at: http://drupal.org/node/1430892
Original report by David_Rothstein
For background on this issue, read #1183042-70: Regression: Add WAI-ARIA roles to Core blocks and the next few comments that follow it.
Here, we should do one of the following:
- Use hook_block_view(). This would rely on #1302482: Ensure render arrays properly handle #attributes and add them there instead of preprocess hooks and the modules would add the WAI-ARIA attributes directly.
- Classify blocks in hook_block_info(), so that the metadata is available in the correct place, and then have template_preprocess_block() add the WAI-ARIA attributes based on that. This would be straightforward also, except the hook_block_info() 'properties' element is currently not stored in the database so it's not available when a block is loaded. We might need to put it in the database for this to work. That's probably a good idea anyway, since currently almost everything in hook_block_info() lives in the database, and it's inconsistent that this one isn't.
I prefer option #2, but either is preferable to the current situation where each module has to implement a theme preprocess function to add the role attribute to its blocks.