ckeditor.api.php 1.65 KB
Newer Older
1 2 3 4 5 6 7
<?php

/**
 * @file
 * Documentation for CKEditor module APIs.
 */

8
use Drupal\editor\Entity\Editor;
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

/**
 * @addtogroup hooks
 * @{
 */

/**
 * Modify the list of available CKEditor plugins.
 *
 * This hook may be used to modify plugin properties after they have been
 * specified by other modules.
 *
 * @param $plugins
 *   An array of all the existing plugin definitions, passed by reference.
 *
24
 * @see \Drupal\ckeditor\CKEditorPluginManager
25 26 27 28 29 30 31 32 33 34 35 36 37
 */
function hook_ckeditor_plugin_info_alter(array &$plugins) {
  $plugins['someplugin']['label'] = t('Better name');
}

/**
 * Modify the list of CSS files that will be added to a CKEditor instance.
 *
 * Modules may use this hook to provide their own custom CSS file without
 * providing a CKEditor plugin. This list of CSS files is only used in the
 * iframe versions of CKEditor.
 *
 * Front-end themes (and base themes) can easily specify CSS files to be used in
38
 * iframe instances of CKEditor through an entry in their .info.yml file:
39 40
 *
 * @code
41 42
 * ckeditor_stylesheets:
 *   - css/ckeditor-iframe.css
43 44 45 46
 * @endcode
 *
 * @param array &$css
 *   An array of CSS files, passed by reference. This is a flat list of file
47
 *   paths which can be either relative to the Drupal root or external URLs.
48 49 50
 * @param $editor
 *   The text editor object as returned by editor_load(), for which these files
 *   are being loaded. Based on this information, it is possible to load the
51
 *   corresponding text format object.
52 53 54 55 56 57 58 59 60 61
 *
 * @see _ckeditor_theme_css()
 */
function hook_ckeditor_css_alter(array &$css, Editor $editor) {
  $css[] = drupal_get_path('module', 'mymodule') . '/css/mymodule-ckeditor.css';
}

/**
 * @} End of "addtogroup hooks".
 */