function popups_get_css in Popups API (Ajax Dialogs) 6.2
Get the added CSSS in a format that is readable by popups.js.
2 calls to popups_get_css()
- popups_preprocess_page in ./
popups.module - Implementation of hook_preprocess_hook().
- popups_render_as_json in ./
popups.module - Render the page contents in a custom json wrapper.
File
- ./
popups.module, line 200 - This module provides a hook_popups for links to be opened in an Ajax Popup Modal Dialog.
Code
function popups_get_css() {
$css = drupal_add_css();
$popup_css = array();
$query_string = '?' . substr(variable_get('css_js_query_string', '0'), 0, 1);
// Only process styles added to "all".
$media = 'all';
foreach ($css[$media] as $type => $files) {
if ($type == 'module') {
// Setup theme overrides for module styles.
$theme_styles = array();
foreach (array_keys($css[$media]['theme']) as $theme_style) {
$theme_styles[] = basename($theme_style);
}
}
foreach ($css[$media][$type] as $file => $preprocess) {
// If the theme supplies its own style using the name of the module style, skip its inclusion.
// This includes any RTL styles associated with its main LTR counterpart.
if ($type == 'module' && in_array(str_replace('-rtl.css', '.css', basename($file)), $theme_styles)) {
// Unset the file to prevent its inclusion when CSS aggregation is enabled.
unset($css[$media][$type][$file]);
continue;
}
// Only include the stylesheet if it exists.
if (file_exists($file)) {
// If a CSS file is not to be preprocessed and it's a module CSS file, it needs to *always* appear at the *top*,
// regardless of whether preprocessing is on or off.
if ($type == 'module') {
$popup_css['module'][$file] = '<link type="text/css" rel="stylesheet" media="' . $media . '" href="' . base_path() . $file . $query_string . '" />' . "\n";
}
elseif ($type == 'theme') {
$popup_css['theme'][$file] = '<link type="text/css" rel="stylesheet" media="' . $media . '" href="' . base_path() . $file . $query_string . '" />' . "\n";
}
else {
$popup_css['unknown'][$file] = '<link type="text/css" rel="stylesheet" media="' . $media . '" href="' . base_path() . $file . $query_string . '" />' . "\n";
}
}
}
}
return $popup_css;
}