You are here

public function TocBuilder::buildContent in TOC API 8

Build a table of contents' body.

Parameters

\Drupal\toc_api\TocInterface $toc: A TOC object.

Return value

array A render array containing the table of content's body content with bookmarked, typed, and custom headers with back to top links.

Overrides TocBuilderInterface::buildContent

File

src/TocBuilder.php, line 96

Class

TocBuilder
Defines a service that builds and renders a table of contents and update an HTML document's headers.

Namespace

Drupal\toc_api

Code

public function buildContent(TocInterface $toc) {
  return [
    '#markup' => $this
      ->renderContent($toc),
    '#allowed_tag' => Xss::getAdminTagList(),
  ];
}