You are here

function popup_preprocess_popup_element in Popup 7

Same name and namespace in other branches
  1. 7.x popup.module \popup_preprocess_popup_element()
  2. 6.x popup.module \popup_preprocess_popup_element()

Popup element preprocessor

Adds CSS of the selected style

1 string reference to 'popup_preprocess_popup_element'
_popup_theme_array in includes/popup.theme.inc
generate a theme array for a specific style

File

./popup.module, line 272

Code

function popup_preprocess_popup_element(&$variables) {
  module_load_include('inc', 'popup', 'includes/popup.util');
  $styles = _popup_styles();
  $style = isset($variables['style']) && $variables['style'] ? $variables['style'] : variable_get('popup-style', 'White');
  $path = isset($styles[$style]) ? $styles[$style] : NULL;
  $variables['classes_array'] = array();
  $variables['attributes_array'] = array();
  $variables['title_attributes_array'] = array();
  $variables['content_attributes_array'] = array();
  if (isset($path)) {
    if (file_exists($path . '/popup-element.css')) {
      drupal_add_css($path . '/popup-element.css', array(
        'media' => 'screen, projection',
        'preprocess' => variable_get('popup-preprocess', FALSE),
        'basename' => _popup_title_to_key($style) . '.popup-element.css',
      ));
    }
    if (file_exists($path . '/popup-element.js')) {
      drupal_add_js($path . '/popup-element.js', array(
        'scope' => 'header',
        'preprocess' => variable_get('popup-preprocess', FALSE),
      ));
    }
  }
}