function menu_target_preprocess_page in Menu target 8
Same name and namespace in other branches
- 7 menu_target.module \menu_target_preprocess_page()
Implements hook_preprocess_page().
File
- ./
menu_target.module, line 37
Code
function menu_target_preprocess_page(&$variables) {
// Only attach the javascript behavior when needed.
$config = Drupal::config('menu_target.settings');
if ($config
->get('enabled') && $config
->get('type') == 'javascript') {
$path = drupal_get_path('module', 'menu_target');
// Render the main scripts file.
$local_js = array(
'#attached' => array(
'js' => array(
$path . '/menu_target.js' => array(
'group' => JS_THEME,
),
'dependencies' => array(
array(
'system',
'drupal',
),
array(
'system',
'jquery',
),
),
),
),
);
drupal_render($local_js);
}
}