_drupal_load_stylesheet
function _drupal_load_stylesheet
_drupal_load_stylesheet($matches)
Loads stylesheets recursively and returns contents with corrected paths.
This function is used for recursive loading of stylesheets and returns the stylesheet content with all url() paths corrected.
File
- includes/common.inc, line 3853
- Common functions that many Drupal modules will need to reference.
Code
function _drupal_load_stylesheet($matches) { $filename = $matches[1]; // Load the imported stylesheet and replace @import commands in there as well. $file = drupal_load_stylesheet($filename, NULL, FALSE); // Determine the file's directory. $directory = dirname($filename); // If the file is in the current directory, make sure '.' doesn't appear in // the url() path. $directory = $directory == '.' ? '' : $directory . '/'; // Alter all internal url() paths. Leave external paths alone. We don't need // to normalize absolute paths here (i.e. remove folder/... segments) because // that will be done later. return preg_replace('/url\(\s*([\'"]?)(?![a-z]+:|\/+)([^\'")]+)([\'"]?)\s*\)/i', 'url(\1' . $directory . '\2\3)', $file); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!common.inc/function/_drupal_load_stylesheet/7.x