annotate vendor/chi-teck/drupal-code-generator/templates/d7/hook/library.twig @ 5:12f9dff5fda9
tip
Update to Drupal core 8.7.1
author |
Chris Cannam |
date |
Thu, 09 May 2019 15:34:47 +0100 |
parents |
c75dbcec494b |
children |
|
rev |
line source |
Chris@0
|
1 /**
|
Chris@0
|
2 * Implements hook_library().
|
Chris@0
|
3 */
|
Chris@0
|
4 function {{ machine_name }}_library() {
|
Chris@0
|
5 // Library One.
|
Chris@0
|
6 $libraries['library-1'] = array(
|
Chris@0
|
7 'title' => 'Library One',
|
Chris@0
|
8 'website' => 'http://example.com/library-1',
|
Chris@0
|
9 'version' => '1.2',
|
Chris@0
|
10 'js' => array(
|
Chris@0
|
11 drupal_get_path('module', 'my_module') . '/library-1.js' => array(),
|
Chris@0
|
12 ),
|
Chris@0
|
13 'css' => array(
|
Chris@0
|
14 drupal_get_path('module', 'my_module') . '/library-2.css' => array(
|
Chris@0
|
15 'type' => 'file',
|
Chris@0
|
16 'media' => 'screen',
|
Chris@0
|
17 ),
|
Chris@0
|
18 ),
|
Chris@0
|
19 );
|
Chris@0
|
20 // Library Two.
|
Chris@0
|
21 $libraries['library-2'] = array(
|
Chris@0
|
22 'title' => 'Library Two',
|
Chris@0
|
23 'website' => 'http://example.com/library-2',
|
Chris@0
|
24 'version' => '3.1-beta1',
|
Chris@0
|
25 'js' => array(
|
Chris@0
|
26 // JavaScript settings may use the 'data' key.
|
Chris@0
|
27 array(
|
Chris@0
|
28 'type' => 'setting',
|
Chris@0
|
29 'data' => array('library2' => TRUE),
|
Chris@0
|
30 ),
|
Chris@0
|
31 ),
|
Chris@0
|
32 'dependencies' => array(
|
Chris@0
|
33 // Require jQuery UI core by System module.
|
Chris@0
|
34 array('system', 'ui'),
|
Chris@0
|
35 // Require our other library.
|
Chris@0
|
36 array('my_module', 'library-1'),
|
Chris@0
|
37 // Require another library.
|
Chris@0
|
38 array('other_module', 'library-3'),
|
Chris@0
|
39 ),
|
Chris@0
|
40 );
|
Chris@0
|
41 return $libraries;
|
Chris@0
|
42 }
|