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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

osopolar created an issue. See original summary.

osopolar’s picture

Status: Active » Needs review
FileSize
647 bytes

This patch will remove the about attribute. Or should this better be part of Lullabot AMP PHP Library?

osopolar’s picture

Issue summary: View changes
FileSize
747 bytes

Remove also typeof attribute.

osopolar’s picture

When $variables['attributes_array']['typeof'] is NULL isset won't work, so use array_key_exists('typeof', $variables['attributes_array']).

KarimBou’s picture

Could 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.