You are here

function amp_rdf_preprocess_user in Accelerated Mobile Pages (AMP) 8.3

Implements hook_preprocess_user() for user templates.

File

modules/amp_rdf/amp_rdf.module, line 55

Code

function amp_rdf_preprocess_user(&$variables) {
  $amp_context = \Drupal::service('router.amp_context');
  if (!$amp_context
    ->isAmpRoute()) {
    return;
  }

  // Remove RDF properties incompatible with AMP specification.
  if (isset($variables['attributes']['about'])) {
    unset($variables['attributes']['about']);
  }
  if (isset($variables['attributes']['typeof'])) {
    unset($variables['attributes']['typeof']);
  }
  if (isset($variables['#attached']['html_head']['rdf_user_username'])) {
    unset($variables['#attached']['html_head']['rdf_user_username']);
  }
}