Skip to content
Snippets Groups Projects
Commit a84eaeee authored by Steve Wirt's avatar Steve Wirt
Browse files

Issue #3359290 by swirt: Implement hook_help() using README.md

parent 771a29d7
No related branches found
No related tags found
No related merge requests found
# GovDelivery Bulletins
This module is used to interact with the Granicus GovDelivery Bulletins API to
send bulletins.
This module provides a set of utilities to have your Drupal powered site use [GovDelivery's Communications Cloud API - Bulletins resource](https://developer.govdelivery.com/api/comm_cloud_v1/Default.htm#API/Comm%20Cloud%20V1/API_CommCloudV1_Bulletins.htm) to create and send Bulletin notifications including an external trigger endpoint. This module supports custom code a developer must create to send the bulletin. It does not create them by itself.
It is more focused in function than the [GovDelivery Integration module](https://www.drupal.org/project/govdelivery).
## How to use the service to add a bulletin to the queue.
......
......@@ -5,6 +5,9 @@
* Module hooks for govdelivery_bulletins module.
*/
use Drupal\Component\Utility\Html;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_twig_theme().
*/
......@@ -35,3 +38,25 @@ function govdelivery_bulletins_twig_theme($existing, $type, $theme, $path) {
],
];
}
/**
* Implements hook_help().
*/
function govdelivery_bulletins_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.govdelivery_bulletins':
$text = file_get_contents(__DIR__ . '/README.md');
if (!\Drupal::moduleHandler()->moduleExists('markdown')) {
return '<pre>' . Html::escape($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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment