You are here

public function Markdown::getParser in Markdown 8.2

Same name and namespace in other branches
  1. 3.0.x src/Markdown.php \Drupal\markdown\Markdown::getParser()

Retrieves a MarkdownParser plugin.

Parameters

string $parserId: Optional. The plugin identifier of a specific MarkdownParser to retrieve. If not provided, the default site-wide parser will be used.

array $configuration: An array of configuration relevant to the plugin instance.

Return value

\Drupal\markdown\Plugin\Markdown\ParserInterface A MarkdownParser plugin.

Overrides MarkdownInterface::getParser

File

src/Markdown.php, line 173

Class

Markdown
Markdown service.

Namespace

Drupal\markdown

Code

public function getParser($parserId = NULL, array $configuration = []) {
  if (empty($parserId)) {
    return $this->parserManager
      ->getDefaultParser($configuration);
  }
  return $this->parserManager
    ->createInstance($parserId, $configuration);
}