You are here

public function FilterMarkdown::setParser in Markdown 8.2

Sets the Filter plugin.

Parameters

\Drupal\markdown\Plugin\Markdown\ParserInterface $parser: A Markdown Parser instance.

Return value

static

Overrides ParserAwareInterface::setParser

1 call to FilterMarkdown::setParser()
FilterMarkdown::setConfiguration in src/Plugin/Filter/FilterMarkdown.php
Sets the configuration for this plugin instance.

File

src/Plugin/Filter/FilterMarkdown.php, line 254

Class

FilterMarkdown
Provides a filter for Markdown.

Namespace

Drupal\markdown\Plugin\Filter

Code

public function setParser(ParserInterface $parser = NULL) {
  if ($parser instanceof FilterAwareInterface) {
    $parser
      ->setFilter($this);
  }

  // Add a cacheable dependency on the filter format, if it exists.
  if ($parser instanceof FilterFormatAwareInterface && ($filterFormat = $this
    ->getFilterFormat())) {
    $parser
      ->setFilterFormat($filterFormat);
    $parser
      ->addCacheableDependency($filterFormat);
  }
  return $this
    ->setParserTrait($parser);
}