$theme_key); drupal_alter('wysiwyg_editor_styles', $elements, $context); $css = array(); return $elements; } /** * Creates a cache of the stylesheets used by the currently set theme. * * Since this is a pre render callback for the styles element, it should run * late enough to catch all the stylesheets added just before the actual markup * for them is rendered. * * The first time this runs for a theme it's too late for a module to have any * use of the cache, so wysiwyg_get_css() uses drupal_http_request() to fetch a * dummy page, filling the cache before the original response is sent. * * Intended to run after Core has sorted/grouped/aggregated stylesheets. */ function _wysiwyg_pre_render_styles($elements) { global $theme_key; if (strpos(current_path(), 'wysiwyg_theme/') !== 0) { return $elements; } $cached = cache_get('wysiwyg_css'); foreach (element_children($elements) as $child) { if ($elements['#groups'][$child]['group'] != CSS_THEME) { continue; } switch ($elements[$child]['#tag']) { case 'link': $css[] = $elements[$child]['#attributes']['href']; break; case 'style': if (!empty($elements[$child]['#attributes']['href'])) { $css[] = $elements[$child]['#attributes']['href']; } elseif (!empty($elements[$child]['#value'])){ preg_match_all('/\@import url\("([^"]+)"\);/', $elements[$child]['#value'], $matches, PREG_SET_ORDER); foreach ($matches as $val) { $css[] = $val[1]; } } break; } $all = empty($cached->data) ? array() : $cached->data; $all[$theme_key] = array('files' => $css, 'aggregated' => variable_get('preprocess_css', FALSE)); } $all['_css_js_query_string'] = variable_get('css_js_query_string'); cache_set('wysiwyg_css', $all); return $elements; }