You are here

public function TocBuilder::buildToc in TOC API 8

Builds a table of contents navigation.

Parameters

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

Return value

array A render array containing a table of contents.

Overrides TocBuilderInterface::buildToc

1 call to TocBuilder::buildToc()
TocBuilder::renderToc in src/TocBuilder.php
Renders a table of contents navigation.

File

src/TocBuilder.php, line 118

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 buildToc(TocInterface $toc) {
  $options = $toc
    ->getOptions();
  return [
    '#theme' => 'toc_' . $options['template'],
    '#toc' => $toc,
  ];
}