This is may be by design, but I thought it was worth noting.
The function rdf_process uses $variables[$variable_name] to set the content that goes inside the wrapping tag. This works fine for date and created because $variables[$variable_name] is the string of rendered HTML, as it is for most template variables.
However, the content variable and the contained elements in taxonomy_term are arrays. So if we try to use rdf_template_variable_wrapper in rdf_preprocess_taxonomy_term, the HTML output is simply the string 'Array' instead of the actual HTML content.
The content variable is an array when it reaches rdf_process in the following cases:
- taxonomy_term
- node (comment, links, and taxonomy)
- comment_wrapper
- user_profile
We could potentially 'fix' this by checking to see if '#markup' is set and then operating on '#markup' if it is. This opens up the potential to insert RDF wrapping tags around just the internal markup of a variable if prefix and suffix are set.
We have ways to get around this problem in every case except taxonomy_term, but allowing people to pass unrendered variables in may provide a helpful amount of flexibility.
Comment | File | Size | Author |
---|---|---|---|
#8 | rdf_templatewrapper_712914_8.patch | 2.1 KB | linclark |
#7 | rdf_templatewrapper_712914_7.patch | 2.1 KB | linclark |
#4 | rdf_templatewrapper_712914_4.patch | 2.05 KB | linclark |
#1 | rdf_templatewrapper_712914_1.patch | 1.45 KB | linclark |
#1 | example_taxonomy-definition.patch | 2.06 KB | linclark |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm attaching a patch and also attaching an example of how this could work in the case of the taxonomy definition. It is probably to late to get the change in for taxonomy definition, but worth looking at.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedFor this to really work, we would also need to fix #712920: rdf_template_variable_attributes_array doesn't allow you to set value for 'inline' because there could be block level elements in the #markup value.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedThis one actually works without any changes to the taxonomy-term.tpl.php.
With this patch, the element that is being wrapped can be at any level in the unrendered attributes array, so we can target elements that are within the main content variable.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedThe check for $variables[$variable_name]['#markup'] was returning the first letter of the string value of $variables[$variable_name] when it was a rendered element.
To prevent this, it now uses is_string to check whether $variables[$variable_name] is a rendered element (HTML string).
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedFixes a small typo in the comments.
Comment #9
effulgentsia CreditAttribution: effulgentsia commentedsubscribing. i will review this in more detail later.
Comment #10
rfay#8: rdf_templatewrapper_712914_8.patch queued for re-testing.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedThis is now included in #1778226: [META] Fix RDF module, but I believe we won't need it anymore with the changes that Twig will bring.
Comment #12
quietone CreditAttribution: quietone as a volunteer commented