Error message

User warning: The following theme is missing from the file system: responsive_green. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1143 of /var/www/moscovie.com/includes/bootstrap.inc).

Добавляем библиотеку с помощью hook_library

/**
* Implements hook_library().
*/
function mymodule_library() {
// path to files "my_library" sites/all/libraries/my_library

// then the path "my_library" can get
// use function drupal_get_path('module', 'mymodule')
$my_library_path = libraries_get_path('my_library');

$libraries['my_library'] = array(
// name variable
'title' => t('My_library'),

'website' => 'http://example.com',
// version library, required field (!)
'version' => '1.1.1',
// path to js files.
'js' => array(
$my_library_path . '/my_library.js' => array(),
$my_library_path . '/my_library.js' => array(),
$my_library_path . '/my_library.js' => array(),
//as well as drupal_add_js() You can set any variable to JS code
array(
'data' => array('mymodule' => array(
'my_library' => array('my_library' => 100)),
),
'type' => 'setting',
),
),
// paths to CSS files.
'css' => array(
$my_library_path . '/my_library.css' => array(),
$my_library_path . '/my_library.css' => array(),
$my_library_path . '/my_library.css' => array(),
),

// Dependence on other libraries
'dependencies' => array(
array('system', 'jquery'),
),
);

return $libraries;
}

How to connect the library?
Like this---
drupal_add_library('mymodule', 'my_library');

also

"#attached"

... some code ...

'#attached' => array(
'library' => array(
array('mymodule', 'super_puper_effect'),
),
),
... some code ...

Категория: 
The code has been tested and works

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.