Commit 060bee93 authored by surbz's avatar surbz Committed by John Avery
Browse files

Issue #2972624 by john_a, surbz, msankhala: marketing_cloud_example.module requires hook_help()

parent 82b33820
<?php
/**
* @file
* Adds example sub-module for demonstrating how to use Marketing Cloud.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function marketing_cloud_example_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.marketing_cloud_example':
$text = file_get_contents(dirname(__FILE__) . '/README.md');
if (!\Drupal::moduleHandler()->moduleExists('markdown')) {
return '<pre>' . $text . '</pre>';
}
else {
// Use the Markdown filter to render the README.
$filter_manager = \Drupal::service('plugin.manager.filter');
$settings = \Drupal::configFactory()->get('markdown.settings')->getRawData();
$config = ['settings' => $settings];
$filter = $filter_manager->createInstance('markdown', $config);
return $filter->process($text, 'en');
}
}
return NULL;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment