You are here

public function AMPTestLibrary::hello in Accelerated Mobile Pages (AMP) 8.3

Same name and namespace in other branches
  1. 8 src/Controller/AMPTestLibrary.php \Drupal\amp\Controller\AMPTestLibrary::hello()
  2. 8.2 src/Controller/AMPTestLibrary.php \Drupal\amp\Controller\AMPTestLibrary::hello()

Hello.

Return value

string

1 string reference to 'AMPTestLibrary::hello'
amp.routing.yml in ./amp.routing.yml
amp.routing.yml

File

src/Controller/AMPTestLibrary.php, line 43

Class

AMPTestLibrary
Class AMPTestLibrary.

Namespace

Drupal\amp\Controller

Code

public function hello() {
  $html_header = PHP_EOL . PHP_EOL . 'OUTPUT HTML' . PHP_EOL;
  $html_header .= '-------------' . PHP_EOL;
  $html = '<p><a href="javascript:run();">Run</a></p>' . PHP_EOL . '<p><a style="margin: 2px;" href="http://www.cnn.com" target="_parent">CNN</a></p>' . PHP_EOL . '<p><a href="http://www.bbcnews.com" target="_blank">BBC</a></p>' . PHP_EOL . '<p><INPUT type="submit" value="submit"></p>' . PHP_EOL . '<div>This is a <!-- test comment -->sample <div onmouseover="hello();">sample</div> paragraph</div>';
  $this->amp
    ->loadHtml($html);
  $amp_html = htmlspecialchars($this->amp
    ->convertToAmpHtml());
  $original_html = PHP_EOL . PHP_EOL . 'ORIGINAL TEST HTML INPUT' . PHP_EOL;
  $original_html .= '-------------------------' . PHP_EOL;
  $original_html .= htmlspecialchars($html);
  return [
    '#type' => 'markup',
    '#markup' => "<h3>The Library is working.</h3><pre>{$html_header} {$amp_html} {$original_html}" . $this->amp
      ->warningsHumanHtml() . "</pre>",
  ];
}