You are here

protected function Html::checkBootstrap in Site Audit 8.3

Check to see if the bootstrap option was selected and wrap in HTMl and add bootstrap derived styles is so.

1 call to Html::checkBootstrap()
Html::render in src/Renderer/Html.php
Render either one report, or multiple.

File

src/Renderer/Html.php, line 138

Class

Html

Namespace

Drupal\site_audit\Renderer

Code

protected function checkBootstrap() {
  if (isset($this->options['bootstrap']) && $this->options['bootstrap']) {
    $this->build = [
      '#type' => 'html_tag',
      '#tag' => 'html',
      'head' => [
        '#type' => 'html_tag',
        '#tag' => 'head',
        'title' => [
          '#type' => 'html_tag',
          '#tag' => 'title',
          '#value' => $this
            ->t('Site Audit report for @site', [
            '@site' => $this->options['uri'],
          ]),
        ],
        'bootstrap' => [
          '#type' => 'html_tag',
          '#tag' => 'link',
          '#attributes' => [
            'href' => 'https://stackpath.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css',
            'rel' => 'stylesheet',
            'crossorigin' => 'anonymous',
          ],
        ],
        'styles' => [
          '#type' => 'html_tag',
          '#tag' => 'style',
          '#value' => $this
            ->getStyles(),
          '#attributes' => [
            'type' => 'text/css',
          ],
        ],
      ],
      'body' => [
        '#type' => 'html_tag',
        '#tag' => 'body',
        $this->build,
      ],
    ];
  }
  elseif (isset($this->options['inline']) && $this->options['inline']) {
    $this->build['#attached']['library'][] = 'site_audit/bootstrap';
  }
}