You are here

function _wysiwyg_filter_editor_styles in Wysiwyg 7.2

A filtering pre render callback for style elements.

Invokes hook_wysiwyg_editor_stules_alter() to allow other code to filter the list of stylesheets which will be used inside the editors in WYSIWYG mode.

Intended to run before Core sorts/groups/aggregates stylesheets.

1 string reference to '_wysiwyg_filter_editor_styles'
wysiwyg_element_info_alter in ./wysiwyg.module
Implements hook_element_info_alter().

File

includes/styling.inc, line 80
Handles adding theme stylesheets into WYSIWYG editors.

Code

function _wysiwyg_filter_editor_styles(&$elements) {
  global $theme_key;
  if (strpos(current_path(), 'wysiwyg_theme/') !== 0) {
    return $elements;
  }

  // Remove any styles that aren't CSS_THEME before processing.
  foreach ($elements['#items'] as $key => $css) {
    if ($css['media'] === 'print' || isset($css['group']) && $css['group'] !== CSS_THEME) {
      unset($elements['#items'][$key]);
    }
  }
  $context = array(
    'theme' => $theme_key,
  );
  drupal_alter('wysiwyg_editor_styles', $elements, $context);
  return $elements;
}