function system_add_module_assets

Adds CSS and JavaScript files declared in module .info files.

1 call to system_add_module_assets()
system_init in modules/system/system.module
Implements hook_init().

File

modules/system/system.module, line 1965

Code

function system_add_module_assets() {
    foreach (system_get_info('module') as $module => $info) {
        if (!empty($info['stylesheets'])) {
            foreach ($info['stylesheets'] as $media => $stylesheets) {
                foreach ($stylesheets as $stylesheet) {
                    drupal_add_css($stylesheet, array(
                        'every_page' => TRUE,
                        'media' => $media,
                    ));
                }
            }
        }
        if (!empty($info['scripts'])) {
            foreach ($info['scripts'] as $script) {
                drupal_add_js($script, array(
                    'every_page' => TRUE,
                ));
            }
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.