function block_token_help in Block Token 8
Same name and namespace in other branches
- 7 block_token.module \block_token_help()
Implements hook_help().
File
- ./
block_token.module, line 21 - Defines necessary hooks and functions for block_token form.
Code
function block_token_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.block_token':
$filepath = dirname(__FILE__) . '/README.txt';
$readme = file_get_contents($filepath);
if (!isset($readme)) {
return NULL;
}
if (\Drupal::moduleHandler()
->moduleExists('markdown')) {
$filters = \Drupal::moduleHandler()
->invoke('markdown', 'filter_info');
$info = $filters['filter_markdown'];
if (function_exists($info['process callback'])) {
$output = $info['process callback']($readme, NULL);
}
else {
$output = '<pre>' . $readme . '</pre>';
}
}
else {
$output = '<pre>' . $readme . '</pre>';
}
return $output;
}
}