You are here

function hook_wysiwyg_editor_styles_alter in Wysiwyg 7.2

Act on stylesheets used in WYSIWYG mode.

This hook acts like a pre-render callback to the style element normally output in the document header. It is invoked before Core has sorted/grouped/aggregated stylesheets and changes made here will only have an effect on the stylesheets used in an editor's WYSIWYG mode. Wysiwyg will only keep items if their type is 'file' or 'inline' and only if they are in the group CSS_THEME.

This hook may be invoked several times in a row with slightly different or altered stylesheets if something like Color module is used by a theme. Wysiwyg will cache the final list of stylesheets so this hook will only be called while the cache is being rebuilt.

Messages set in this hook will not be displayed because the processing is done in an internal HTTP request and the page output is ignored.

Parameters

$elements: The style element which will be rendered. Added stylesheets are found in $element['#items']['path/to/stylesheet.css'].

$context: An array with the following keys:

  • theme: The name of the theme which was used when the list of stylesheets was generated.
1 invocation of hook_wysiwyg_editor_styles_alter()
_wysiwyg_filter_editor_styles in includes/styling.inc
A filtering pre render callback for style elements.

File

./wysiwyg.api.php, line 361
API documentation for Wysiwyg module.

Code

function hook_wysiwyg_editor_styles_alter(&$element, $context) {
  if ($context['theme'] == 'alpha') {
    unset($element['#items']['sites/all/themes/omega/alpha/css/alpha-debug.css']);
  }
}