-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap_pages.module
63 lines (59 loc) · 1.54 KB
/
bootstrap_pages.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* @file
* Bootstrap Pages module file.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_theme().
*
* Look for these templates in the Bootstrap Pages module.
*/
function bootstrap_pages_theme($existing, $type, $theme, $path) {
return [
'field__bpg_featured_image' => [
'base hook' => 'node',
],
'field__bpg_related_articles' => [
'base hook' => 'node',
],
'node__bpg_article' => [
'base hook' => 'node',
],
'node__bpg_article__teaser' => [
'base hook' => 'node',
],
'node__bpg_author' => [
'base hook' => 'node',
],
'node__bpg_landing_page' => [
'base hook' => 'node',
],
'media__bpg_featured_image' => [
'base hook' => 'media',
],
];
}
/**
* Implements hook_help().
*
* @inheritdoc
*/
function bootstrap_pages_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.bootstrap_pages':
$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;
}