' . t('About') . '';
$output .= '
' . t('The CKEditor module provides a highly-accessible, highly-usable visual text editor and adds a toolbar to text fields. Users can use buttons to format content and to create semantically correct and valid HTML. The CKEditor module uses the framework provided by the Text Editor module. It requires JavaScript to be enabled in the browser. For more information, see the online documentation for the CKEditor module and the CKEditor website.', [':doc_url' => 'https://www.drupal.org/documentation/modules/ckeditor', ':cke_url' => 'http://ckeditor.com', ':text_editor' => Url::fromRoute('help.page', ['name' => 'editor'])->toString()]) . '
';
$output .= '' . t('Uses') . '
';
$output .= '';
$output .= '- ' . t('Enabling CKEditor for individual text formats') . '
';
$output .= '- ' . t('CKEditor has to be enabled and configured separately for individual text formats from the Text formats and editors page because the filter settings for each text format can be different. For more information, see the Text Editor help page and Filter help page.', [':formats' => Url::fromRoute('filter.admin_overview')->toString(), ':text_editor' => Url::fromRoute('help.page', ['name' => 'editor'])->toString(), ':filter' => Url::fromRoute('help.page', ['name' => 'filter'])->toString()]) . '
';
$output .= '- ' . t('Configuring the toolbar') . '
';
$output .= '- ' . t('When CKEditor is chosen from the Text editor drop-down menu, its toolbar configuration is displayed. You can add and remove buttons from the Active toolbar by dragging and dropping them, and additional rows can be added to organize the buttons.') . '
';
$output .= '- ' . t('Formatting content') . '
';
$output .= '- ' . t('CKEditor only allow users to format content in accordance with the filter configuration of the specific text format. If a text format excludes certain HTML tags, the corresponding toolbar buttons are not displayed to users when they edit a text field in this format. For more information see the Filter help page.', [':filter' => Url::fromRoute('help.page', ['name' => 'filter'])->toString()]) . '
';
$output .= '- ' . t('Toggling between formatted text and HTML source') . '
';
$output .= '- ' . t('If the Source button is available in the toolbar, users can click this button to disable the visual editor and edit the HTML source directly. After toggling back, the visual editor uses the allowed HTML tags to format the text — independent of whether buttons for these tags are available in the toolbar. If the text format is set to limit the use of HTML tags, then all excluded tags will be stripped out of the HTML source when the user toggles back to the text editor.') . '
';
$output .= '- ' . t('Check my spelling as I type') . '
';
$output .= '- ' . t("By default, CKEditor is configured to leverage your browser's spell check capability. Make sure your browser's spell checker is enabled in your browser's settings. To access suggested corrections for misspelled words, it may be necessary to hold the Control or command (Mac) key while right-clicking the misspelling.") . '
';
$output .= '- ' . t('Accessibility features') . '
';
$output .= '- ' . t('The built in WYSIWYG editor (CKEditor) comes with a number of accessibility features. CKEditor comes with built in keyboard shortcuts, which can be beneficial for both power users and keyboard only users.', [':features' => 'http://docs.ckeditor.com/#!/guide/dev_a11y', ':shortcuts' => 'http://docs.ckeditor.com/#!/guide/dev_shortcuts']) . '
';
$output .= '- ' . t('Generating accessible content') . '
';
$output .= '- ';
$output .= '
';
$output .= '- ' . t('HTML tables can be created with table headers and caption/summary elements.') . '
';
$output .= '- ' . t('Alt text is required by default on images added through CKEditor (note that this can be overridden).') . '
';
$output .= '- ' . t('Semantic HTML5 figure/figcaption are available to add captions to images.') . '
';
$output .= '- ' . t('To support multilingual page content, CKEditor can be configured to include a language button in the toolbar.') . '
';
$output .= '
';
$output .= ' ';
$output .= '
';
return $output;
}
}
/**
* Implements hook_theme().
*/
function ckeditor_theme() {
return [
'ckeditor_settings_toolbar' => [
'file' => 'ckeditor.admin.inc',
'variables' => ['editor' => NULL, 'plugins' => NULL],
],
];
}
/**
* Implements hook_ckeditor_css_alter().
*/
function ckeditor_ckeditor_css_alter(array &$css, Editor $editor) {
if (!$editor->hasAssociatedFilterFormat()) {
return;
}
// Add the filter caption CSS if the text format associated with this text
// editor uses the filter_caption filter. This is used by the included
// CKEditor DrupalImageCaption plugin.
if ($editor->getFilterFormat()->filters('filter_caption')->status) {
$css[] = drupal_get_path('module', 'filter') . '/css/filter.caption.css';
}
}
/**
* 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.
*
* @code
* ckeditor_stylesheets:
* - css/ckeditor-iframe.css
* @endcode
*/
function _ckeditor_theme_css($theme = NULL) {
$css = [];
if (!isset($theme)) {
$theme = \Drupal::config('system.theme')->get('default');
}
if (isset($theme) && $theme_path = drupal_get_path('theme', $theme)) {
$info = \Drupal::service('extension.list.theme')->getExtensionInfo($theme);
if (isset($info['ckeditor_stylesheets'])) {
$css = $info['ckeditor_stylesheets'];
foreach ($css as $key => $url) {
// CSS url is external.
if (UrlHelper::isExternal($url)) {
$css[$key] = $url;
}
// CSS url is relative to Drupal root.
elseif ($url[0] === '/') {
$css[$key] = substr($url, 1);
}
// CSS url is relative to theme.
else {
$css[$key] = $theme_path . '/' . $url;
}
}
}
if (isset($info['base theme'])) {
$css = array_merge(_ckeditor_theme_css($info['base theme']), $css);
}
}
return $css;
}
/**
* Implements hook_library_info_alter().
*/
function ckeditor_library_info_alter(&$libraries, $extension) {
// Pass Drupal's JS cache-busting string via settings along to CKEditor.
// @see http://docs.ckeditor.com/#!/api/CKEDITOR-property-timestamp
if ($extension === 'ckeditor' && isset($libraries['drupal.ckeditor'])) {
$query_string = \Drupal::state()->get('system.css_js_query_string', '0');
$libraries['drupal.ckeditor']['drupalSettings']['ckeditor']['timestamp'] = $query_string;
}
}