js_example.module
756 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
31
32
33
34
35
36
37
<?php
/**
* @file
* Examples showing how to use some of the new JavaScript features in Drupal 8.
*/
/**
* @defgroup js_example Example: JavaScript
* @ingroup examples
* @{
* Examples using Drupal 8's built-in JavaScript.
*
* We have two examples here.
*
* One 'weights' content and then sorts it by weight. This demonstrates
* attaching JavaScript through Drupal's render arrays.
*
* The other demonstrates adding an accordion effect to content, through
* Drupal's theme layer.
*/
/**
* Implements hook_theme().
*/
function js_example_theme() {
return array(
'js_example_accordion' => array(
'template' => 'accordion',
'variables' => array('title' => NULL),
),
);
}
/**
* @} End of "defgroup js_example".
*/