Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. HTML.php

function HTML::printToc

Print the table of contents for the standard.

The TOC is just an unordered list of bookmarks to sniffs on the page.

Return value

void

1 call to HTML::printToc()
HTML::generate in vendor/squizlabs/php_codesniffer/src/Generators/HTML.php
Generates the documentation for a standard.

File

vendor/squizlabs/php_codesniffer/src/Generators/HTML.php, line 153

Class

HTML

Namespace

PHP_CodeSniffer\Generators

Code

protected function printToc() {
    echo '  <h2>Table of Contents</h2>' . PHP_EOL;
    echo '  <ul class="toc">' . PHP_EOL;
    foreach ($this->docFiles as $file) {
        $doc = new DOMDocument();
        $doc->load($file);
        $documentation = $doc->getElementsByTagName('documentation')
            ->item(0);
        $title = $this->getTitle($documentation);
        echo '   <li><a href="#' . str_replace(' ', '-', $title) . "\">{$title}</a></li>" . PHP_EOL;
    }
    echo '  </ul>' . PHP_EOL;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal