You are here

public function PhpMarkdown::getPhpMarkdown in Markdown 8.2

Retrieves the PHP Markdown parser.

Return value

\Michelf\Markdown A PHP Markdown parser.

File

src/Plugin/Markdown/PhpMarkdown/PhpMarkdown.php, line 175

Class

PhpMarkdown
Support for PHP Markdown by Michel Fortin.

Namespace

Drupal\markdown\Plugin\Markdown\PhpMarkdown

Code

public function getPhpMarkdown() {
  if (!$this->phpMarkdown) {
    $this->phpMarkdown = new static::$phpMarkdownClass();
    $settings = $this
      ->getSettings();

    // Unless the render strategy is set to "none", force the
    // following settings to be disabled.
    if ($this
      ->getRenderStrategy() !== static::NONE) {
      $settings['no_entities'] = FALSE;
      $settings['no_markup'] = FALSE;
    }

    // Set settings.
    foreach ($this
      ->getSettings() as $name => $value) {
      if ($this
        ->settingExists($name)) {
        $this->phpMarkdown->{$name} = $value;
      }
    }
  }
  return $this->phpMarkdown;
}