You are here

function datex_popup_js_alter in Datex 7.3

Same name and namespace in other branches
  1. 7.2 datex_popup/datex_popup.module \datex_popup_js_alter()

Implements hook_js_alter().

Whenever date_popup.js is loaded, Remove it and inject datex library.

File

datex_popup/datex_popup.module, line 54

Code

function datex_popup_js_alter(&$js) {
  foreach (array_keys($js) as $each) {
    foreach ([
      'locale.datepicker.js',
      'date_popup.js',
      'jquery.ui.datepicker.min.js',
      'timeentry',
      'timepicker',
    ] as $unset) {
      if (strpos($each, $unset) !== FALSE) {
        unset($js[$each]);

        // instead use ours
        _datex_add_lib();
      }
    }
  }
}