_ckeditor_theme_css

_ckeditor_theme_css($theme = NULL)

Retrieves the default theme's CKEditor stylesheets.

Themes may specify iframe-specific CSS files for use with CKEditor by including a "ckeditor_stylesheets" key in their .info.yml file.

ckeditor_stylesheets:
  - css/ckeditor-iframe.css

File

core/modules/ckeditor/ckeditor.module, line 81
Provides integration with the CKEditor WYSIWYG editor.

Code

function _ckeditor_theme_css($theme = NULL) {
  $css = array();
  if (!isset($theme)) {
    $theme = \Drupal::config('system.theme')->get('default');
  }
  if (isset($theme) && $theme_path = drupal_get_path('theme', $theme)) {
    $info = system_get_info('theme', $theme);
    if (isset($info['ckeditor_stylesheets'])) {
      $css = $info['ckeditor_stylesheets'];
      foreach ($css as $key => $url) {
        if (UrlHelper::isExternal($url)) {
          $css[$key] = $url;
        }
        else {
          $css[$key] = $theme_path . '/' . $url;
        }
      }
    }
    if (isset($info['base theme'])) {
      $css = array_merge(_ckeditor_theme_css($info['base theme']), $css);
    }
  }
  return $css;
}
doc_Drupal
2016-10-29 09:57:06
Comments
Leave a Comment

Please login to continue.