You are here

public static function AmpProcessedText::warningsOn in Accelerated Mobile Pages (AMP) 8.2

Same name and namespace in other branches
  1. 8 src/Element/AmpProcessedText.php \Drupal\amp\Element\AmpProcessedText::warningsOn()

Does the user want to see AMP Library warnings?

Return value

bool

1 call to AmpProcessedText::warningsOn()
AmpProcessedText::preRenderAmpText in src/Element/AmpProcessedText.php
Pre-render callback: Processes the amp markup and attaches libraries.

File

src/Element/AmpProcessedText.php, line 43

Class

AmpProcessedText
Provides an amp-processed text render element.

Namespace

Drupal\amp\Element

Code

public static function warningsOn() {

  // First check the config if library warnings are on
  $amp_config = self::configFactory()
    ->get('amp.settings');
  if ($amp_config
    ->get('amp_library_warnings_display')) {
    return true;
  }

  // Then check the URL if library warnings are enabled

  /** @var Request $request */
  $request = \Drupal::request();
  $user_wants_amp_library_warnings = $request
    ->get('warnfix');
  if (isset($user_wants_amp_library_warnings)) {
    return true;
  }
  return false;
}