You are here

public function ParserManager::getDefaultParser in Markdown 8.2

Retrieves the site-wide default MarkdownParser plugin.

Parameters

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

Return value

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

Overrides ParserManagerInterface::getDefaultParser

File

src/PluginManager/ParserManager.php, line 83

Class

ParserManager
Markdown Parser Plugin Manager.

Namespace

Drupal\markdown\PluginManager

Code

public function getDefaultParser(array $configuration = []) {
  $settings = $this->configFactory
    ->get('markdown.settings');
  if (!($defaultParser = $settings
    ->get('default_parser'))) {
    $defaultParser = current(array_keys($this
      ->installed()));
    $this->logger
      ->warning($this
      ->t('No default markdown parser set, using first available installed parser "@default_parser".', [
      '@default_parser' => $defaultParser,
    ]));
  }
  return $this
    ->createInstance($defaultParser, $configuration);
}