forked from ybabel/drupal8-hello-world
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.module
More file actions
executable file
·31 lines (24 loc) · 887 Bytes
/
hello.module
File metadata and controls
executable file
·31 lines (24 loc) · 887 Bytes
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
<?php
//Console debug output
//file_put_contents("php://stdout", sprintf("test"));
function hello_theme() {
return array(
'hello_text' => array(
'template' => 'hello-text',
'variables' => array('text' => NULL)
),
);
}
use Drupal\Core\Block\BlockPluginInterface;
function hello_block_view_hello_block_alter(array &$build, BlockPluginInterface $block) {
$build = array('#theme' => 'hello_text', '#text' => 'you have been hooked');
}
use Drupal\Core\Form\FormStateInterface;
function hello_form_hello_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
$form['hello_config']['#description'] = t('This hooked text will appear in the form.');
}
//hook_menu_alter does not exist any more in D8
function hello_menu_links_discovered_alter(&$links) {
// do not use route name but route ID
$links['hello.main']['title'] = 'Hello hooked';
}