Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The function template_preprocess_entity() of the module Entity API may add an invalid attribute "about" (i.e. for field-collections if the core rdf module is enabled).
This could be easily fixed in the via template_preprocess_entity(), like:
/**
* Implements template_preprocess_entity().
*/
function amp_preprocess_entity(&$variables) {
if (!isset($variables['view_mode']) || 'amp' != $variables['view_mode']) {
return;
}
// Unset unallowed attributes about, set by template_preprocess_entity().
if (isset($variables['attributes_array']['about'])) {
unset($variables['attributes_array']['about']);
}
if (isset($variables['attributes_array']['typeof'])) {
unset($variables['attributes_array']['typeof']);
}
}
This could be done in the custom theme or by this module.
Comment | File | Size | Author |
---|---|---|---|
#4 | amp-remove-about-attribute-from-entity-api-2790109-4.patch | 851 bytes | osopolar |
Comments
Comment #2
osopolarThis patch will remove the about attribute. Or should this better be part of Lullabot AMP PHP Library?
Comment #3
osopolarRemove also typeof attribute.
Comment #4
osopolarWhen
$variables['attributes_array']['typeof']
isNULL
isset won't work, so usearray_key_exists('typeof', $variables['attributes_array'])
.Comment #5
KarimBou CreditAttribution: KarimBou commentedCould we implement an unset of 'property' on elements such as span. How would you do that in a theme ?
Because it's causing the same issue on AMP Validator, for instance coming from RDF Module.