You are here

function popup_ui_enable in Popup 7

Same name and namespace in other branches
  1. 8 modules/popup_ui/popup_ui.module \popup_ui_enable()
  2. 7.x modules/popup_ui/popup_ui.module \popup_ui_enable()
  3. 6.x modules/popup_ui/popup_ui.module \popup_ui_enable()

Implementation of hook_enable

Hooked to alter the system weight of this module so that the popup_ui hook_popup_attributes_alter is fired before the popup module.

It is important that the format attributes are added to the attributes array before default values are added.

File

modules/popup_ui/popup_ui.module, line 20

Code

function popup_ui_enable() {
  module_load_include('inc', 'popup_ui', 'includes/popup_ui.util');

  // Get the weight of popup
  $weight = @array_pop(db_select('system', 's')
    ->fields('s', array(
    'weight',
  ))
    ->condition('name', 'popup', '=')
    ->execute()
    ->fetchAssoc());

  // Set the weight of popup_ui to one less than popup
  db_update('system')
    ->fields(array(
    'weight' => $weight - 1,
  ))
    ->condition('name', 'popup_ui', '=')
    ->execute();
  _popup_ui_flush_all();
}