-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtw_paragraphs.module
More file actions
79 lines (75 loc) · 2.13 KB
/
tw_paragraphs.module
File metadata and controls
79 lines (75 loc) · 2.13 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* @file
* Tailwind CSS Paragraphs module file.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_theme().
*/
function tw_paragraphs_theme($existing, $type, $theme, $path) {
return [
'paragraph__default' => [
'base hook' => 'paragraph',
],
// 'paragraph__tw_accordion' => [
// 'base hook' => 'paragraph',
// ],
// 'paragraph__tw_carousel' => [
// 'base hook' => 'paragraph',
// ],
// 'paragraph__tw_tabs' => [
// 'base hook' => 'paragraph',
// ],
// 'paragraph__tw_columns_three_uneven' => [
// 'base hook' => 'paragraph',
// ],
// 'paragraph__tw_columns_two_uneven' => [
// 'base hook' => 'paragraph',
// ],
// 'paragraph__tw_image' => [
// 'base hook' => 'paragraph',
// ],
// 'paragraph__tw_modal' => [
// 'base hook' => 'paragraph',
// ],
// 'field__entity_reference_revisions' => [
// 'base hook' => 'paragraph',
// ],
// 'field__paragraph__tw_column_content' => [
// 'base hook' => 'paragraph',
// ],
// 'field__paragraph__tw_column_content_2' => [
// 'base hook' => 'paragraph',
// ],
// 'field__paragraph__tw_column_content_3' => [
// 'base hook' => 'paragraph',
// ],
// 'field__paragraph__tw_image__image' => [
// 'base hook' => 'paragraph',
// ],
];
}
/**
* Implements hook_help().
*
* @inheritdoc
*/
function tw_paragraphs_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.tw_paragraphs':
$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;
}