History:

  • To implement rdf.module, we needed the ability for modules to set HTML attributes on all sorts of themeable output. We wanted this to be friendly for themers, and as much as possible, we wanted to solve this problem of a themer-friendly way of module-specified attributes generically, since in theory, modules other than rdf might need to put attributes on stuff. This led to #569362: Document $attributes, $title_attributes, and $content_attributes template variables, which between that, and some side issues, established a convention of $variables['attributes_array'], $variables['title_attributes_array'], $variables['content_attributes_array'], and $variables['item_attributes_array'] as being module-independant variables that any module's preprocess function can add to for any template (except 'item_attributes_array' which only applies to field.tpl.php).
  • This was great, but didn't cover every piece of output that RDFa was needed on, which led to a proposal for a generic $variables['template_variable_attributes_array'] in #607456: RDF still needs one more mechanism to get attributes on a themer accessible element, but this was shot down as being too icky and as it was only needed by rdf.module, the proposal was to move the ickiness to there, which was committed on #493030-158: RDF #1: core RDF module using the name $variables['rdf_template_variable_attributes_array'].
  • It's correctly pointed out on #614444-14: More consistent RDFa logic for username that this is a needlessly long name.
CommentFileSizeAuthor
drupal.rdf_attributes_array.patch3.81 KBeffulgentsia

Comments

sun’s picture

+++ modules/rdf/rdf.module	16 Nov 2009 03:11:12 -0000
@@ -587,8 +587,8 @@ function rdf_preprocess_field_formatter_
- *     set 'rdf_template_variable_attributes_array' for a particular template
...
+ *     set 'rdf_attributes_array' for a particular template variable that might
...
  *     hook_preprocess_rdf_template_variable_wrapper() and set 'inline' to FALSE

Was hook_preprocess_rdf_template_variable_wrapper() named to be consistent, and, can it be renamed, too?

This review is powered by Dreditor.

effulgentsia’s picture

It can be renamed, but it's a preprocess function, so it would need to be named same as the theme function: theme_rdf_XXX() and hook_preprocess_rdf_XXX(). What do you suggest? What the theme function does is take a string that would normally go to a template file (e.g., node.tpl.php or comment.tpl.php), and wrap a SPAN or DIV around it in order to add attributes, so that the template file receives the variable it expects (e.g., $author), but already containing the rdfa markup needed, so that the template file doesn't need to do anything to have these miscellaneous variables (variables other than $title and $content) contain the necessary markup. What should a theme function whose purpose is to wrap a template variable with RDFa be named?

sun’s picture

drupal.rdf_attributes_array.patch queued for re-testing.

retester2010’s picture

drupal.rdf_attributes_array.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, drupal.rdf_attributes_array.patch, failed testing.

Anonymous’s picture

Status: Needs work » Closed (cannot reproduce)

The variable doesn't exist in D8.