You are here

public static function DrupalParsedValidatorRules::updatedRules in Accelerated Mobile Pages (AMP) 8.3

Adds an alter hook to update AMP rules that might be causing problems.

The original code in Lullabot/AMP is out of date with the current AMP specifications. Updating that code is a non-trivial job that may not get done any time soon. This is a work-around to allow changes to the rules.

@TODO Add caching.

See also

https://github.com/Lullabot/amp-library/blob/master/src/Spec/validator-g...

1 call to DrupalParsedValidatorRules::updatedRules()
DrupalParsedValidatorRules::getSingletonParsedValidatorRules in src/AMP/DrupalParsedValidatorRules.php

File

src/AMP/DrupalParsedValidatorRules.php, line 40

Class

DrupalParsedValidatorRules
Drupal override of Lullabot\ParsedValidatorRules.

Namespace

Drupal\amp\AMP

Code

public static function updatedRules() {
  $rules = ValidationRulesFactory::createValidationRules();

  // Allow other modules to alter the rules.
  \Drupal::moduleHandler()
    ->alter('amp_rules', $rules);
  return $rules;
}