You are here

protected function TocBlockBase::getCurrentToc in TOC API 8

Get the current request TOC object instance.

Return value

\Drupal\toc_api\TocInterface A TOC object.

1 call to TocBlockBase::getCurrentToc()
TocBlockBase::build in src/Plugin/Block/TocBlockBase.php
Builds and returns the renderable array for this block plugin.

File

src/Plugin/Block/TocBlockBase.php, line 89

Class

TocBlockBase
Provides a base TOC block which displays the current TOC module's TOC in a block.

Namespace

Drupal\toc_api\Plugin\Block

Code

protected function getCurrentToc() {

  /** @var \Drupal\toc_api\TocManagerInterface $toc_manager */
  $toc_manager = \Drupal::service('toc_api.manager');

  // Get the new TOC instance using the module name.
  return $toc_manager
    ->getToc($this
    ->getCurrentTocId());
}