Skip to content

Commit

Permalink
Issue #1962358 by penyaskito: Remove hook_library and use token.libra…
Browse files Browse the repository at this point in the history
…ries.yml instead. See https://drupal.org/node/2201089
  • Loading branch information
penyaskito committed Mar 1, 2014
1 parent 8c3032e commit 204d22f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
10 changes: 10 additions & 0 deletions token.libraries.yml
@@ -0,0 +1,10 @@
jquery.treeTable:
remote: 'http://plugins.jquery.com/project/treetable'
version: 2.3.0
js:
js/jquery.treeTable.js: {}
css:
component:
css/jquery.treeTable.css: {}
dependencies:
- core/jquery
20 changes: 0 additions & 20 deletions token.module
Expand Up @@ -155,26 +155,6 @@ function token_theme() {
);
}

/**
* Implements hook_library().
*/
function token_library() {
// jQuery treeTable plugin.
$libraries['treeTable'] = array(
'title' => 'jQuery treeTable',
'website' => 'http://plugins.jquery.com/project/treetable',
'version' => '2.3.0',
'js' => array(
drupal_get_path('module', 'token') . '/jquery.treeTable.js' => array(),
),
'css' => array(
drupal_get_path('module', 'token') . '/jquery.treeTable.css' => array(),
),
);

return $libraries;
}

/**
* Implements hook_form_alter().
*
Expand Down
5 changes: 3 additions & 2 deletions token.pages.inc
Expand Up @@ -20,7 +20,8 @@ function theme_tree_table($variables) {
}

if (!empty($variables['rows'])) {
drupal_add_library('token', 'treeTable');
$attached['#attached']['library'][] = array('token', 'jquery.treeTable');
drupal_render($attached);
}

// ToDo: Use render arrays. See https://drupal.org/node/2195739
Expand Down Expand Up @@ -99,7 +100,7 @@ function theme_token_tree($variables) {
'#attached' => array(
'js' => array(drupal_get_path('module', 'token') . '/token.js'),
'css' => array(drupal_get_path('module', 'token') . '/token.css'),
'library' => array(array('token', 'treeTable')),
'library' => array(array('token', 'jquery.treeTable')),
),
);

Expand Down

0 comments on commit 204d22f

Please sign in to comment.