drupal_get_css($css = NULL)Returns a themed representation of all stylesheets that should be attached to the page.
It loads the CSS in order, with 'module' first, then 'theme' afterwards. This ensures proper cascading of styles so themes can easily override module styles through CSS selectors.
Themes may replace module-defined CSS files by adding a stylesheet with the same filename. For example, themes/garland/system-menus.css would replace modules/system/system-menus.css. This allows themes to override complete CSS files, rather than specific selectors, when necessary.
If the original CSS file is being overridden by a theme, the theme is responsible for supplying an accompanying RTL CSS file to replace the module's.
$css (optional) An array of CSS files. If no array is provided, the default stylesheets array is used instead.
A string of XHTML CSS tags.
includes/common.inc, line 2729
<?php
function drupal_get_css($css = NULL) {
if (!isset($css)) {
$css = drupal_add_css();
}
// Allow modules to alter the CSS items.
drupal_alter('css', $css);
// Sort CSS items according to their weights.
uasort($css, 'drupal_sort_weight');
// Remove the overridden CSS files. Later CSS files override former ones.
$previous_item = array();
foreach ($css as $key => $item) {
if ($item['type'] == 'file') {
$basename = basename($item['data']);
if (isset($previous_item[$basename])) {
// Remove the previous item that shared the same base name.
unset($css[$previous_item[$basename]]);
}
$previous_item[$basename] = $key;
}
}
// Render the HTML needed to load the CSS.
$styles = array(
'#type' => 'styles',
'#items' => $css,
);
return drupal_render($styles);
}
?>