You are here

function markdown_modules_installed in Markdown 8.2

Implements hook_modules_installed(). @noinspection PhpUnused @noinspection PhpDocSignatureInspection

File

./markdown.module, line 141
Markdown module.

Code

function markdown_modules_installed($modules) {

  // Immediately return if not installing the markdown module.
  if (!in_array('markdown', $modules, TRUE)) {
    return;
  }

  // Save the first found parser as the default global parser.

  /** @var \Drupal\markdown\PluginManager\ParserManagerInterface $parserManager */
  $parserManager = \Drupal::service('plugin.manager.markdown.parser');
  if ($parserId = current(array_keys($parserManager
    ->installedDefinitions()))) {
    \Drupal::configFactory()
      ->getEditable('markdown.settings')
      ->set('default_parser', $parserId)
      ->save();
  }
}