function sharethis_block_help in Sharethis block 8
Implements hook_help().
File
- ./
sharethis_block.module, line 45 - Hook implementations for the sharethis_block module.
Code
function sharethis_block_help($route_name, RouteMatchInterface $route_match) {
if ($route_name === 'help.page.sharethis_block') {
$readme_file = file_exists(__DIR__ . '/README.md') ? __DIR__ . '/README.md' : __DIR__ . '/README.txt';
if (!file_exists($readme_file)) {
return NULL;
}
// Use the Markdown filter to render the README.
if (method_exists('Drupal\\markdown\\Markdown', 'create')) {
return Drupal\markdown\Markdown::create()
->loadPath($readme_file);
}
// Fall back to plain text.
$text = file_get_contents($readme_file);
return '<pre>' . Html::escape($text) . '</pre>';
}
return NULL;
}