You are here

function hook_tinymce_css_alter in TinyMCE 7

Modify the list of CSS files that will be added to a TinyMCE instance.

Modules may use this hook to provide their own custom CSS file without providing a TinyMCE plugin. This list of CSS files is only used in the iframe versions of TinyMCE.

Note that because this hook is only called for modules and the active theme, front-end themes will not be able to use this hook to add their own CSS files if a different admin theme is active. Instead, front-end themes and base themes may specify CSS files to be used in iframe instances of TinyMCE through an entry in their .info file:

tinymce_stylesheets[] = css / tinymce - iframe . css;

Parameters

$css: An array of CSS files, passed by reference. This is a flat list of file paths relative to the Drupal root.

$editor: The editor object as returned by editor_load(), for which these files are being loaded.

$format: The corresponding text format object as returned by filter_format_load() for which the current text editor is being displayed.

See also

_tinymce_theme_css()

1 invocation of hook_tinymce_css_alter()
tinymce_add_settings in ./tinymce.module
Editor JS settings callback; Add Aloha settings to the page for a format.

File

./tinymce.api.php, line 117
Documentation for TinyMCE module APIs.

Code

function hook_tinymce_css_alter(array &$css, $editor, $format) {
  $css[] = drupal_get_path('module', 'mymodule') . '/css/mymodule-tinymce.css';
}