diff --git a/context_addassets.module b/context_addassets.module index 24cc2b3..64a21b7 100755 --- a/context_addassets.module +++ b/context_addassets.module @@ -114,6 +114,17 @@ function context_addassets_admin() { ); $path_index += 1; } + + $form['context_addassets_scope'] = array( + '#type' => 'select', + '#title' => 'Scope of where to place the javascript assets', + '#options' => array( + 'header' => 'Header', + 'footer' => 'Footer', + ), + '#default_value' => variable_get('context_addassets_scope', 'header') + ); + return system_settings_form($form); } diff --git a/plugins/context_reaction_addassets_base.inc b/plugins/context_reaction_addassets_base.inc index 9e8e5b1..15fe3cf 100644 --- a/plugins/context_reaction_addassets_base.inc +++ b/plugins/context_reaction_addassets_base.inc @@ -103,6 +103,7 @@ class context_reaction_addassets_base extends context_reaction { */ function execute() { $contexts = context_active_contexts(); + $scope = variable_get('context_addassets_scope', 'header'); $classes = array(); //dpm($contexts); foreach ($contexts as $key => $value) { @@ -116,7 +117,7 @@ class context_reaction_addassets_base extends context_reaction { switch ($ext) { case 'js': - drupal_add_js($path, array('group' => JS_DEFAULT)); + drupal_add_js($path, array('group' => JS_DEFAULT, 'scope' => $scope)); break; case 'css': case 'less':