You are here

function improved_multi_select_preprocess_page in Improved Multi Select 7

Same name and namespace in other branches
  1. 7.2 improved_multi_select.module \improved_multi_select_preprocess_page()

Implements templage_preprocess_page().

File

./improved_multi_select.module, line 11
The improved_multi_select module main php code.

Code

function improved_multi_select_preprocess_page() {
  $is_enabled = FALSE;
  $url = trim(variable_get('improved_multi_select:url', ''));
  $selectors = array_filter(explode("\n", str_replace("\r", "\n", trim(variable_get('improved_multi_select:selectors', '')))));
  if ($replace_all = variable_get('improved_multi_select:isall', FALSE)) {
    $is_enabled = TRUE;
  }
  else {
    if ($url && drupal_match_path(request_path(), $url) || $selectors) {
      $is_enabled = TRUE;
    }
  }
  if ($is_enabled) {
    $selectors = improved_multi_select_load_selectors($replace_all, $selectors);
    drupal_add_css(drupal_get_path('module', 'improved_multi_select') . '/improved_multi_select.css');
    drupal_add_js(drupal_get_path('module', 'improved_multi_select') . '/improved_multi_select.js');
    drupal_add_js(array(
      'improved_multi_select' => array(
        'selectors' => $selectors,
      ),
    ), 'setting');
  }
}