function fontawesome_ckeditor_css_alter in Font Awesome Icons 8.2
Same name and namespace in other branches
- 8 fontawesome.module \fontawesome_ckeditor_css_alter()
Implements hook_ckeditor_css_alter().
This function allows for the proper functionality of the icons inside the CKEditor when using Webfonts with CSS as the Font Awesome display method.
See fontawesome_editor_js_settings_alter() for allowing the use of the icons inside CKEditor when using the SVG with JS display method.
File
- ./
fontawesome.module, line 172 - Drupal integration with Font Awesome, the iconic font for use with Bootstrap.
Code
function fontawesome_ckeditor_css_alter(&$css, $editor) {
// Attach the main library if we're using the CSS webfonts method..
if (\Drupal::config('fontawesome.settings')
->get('method') == 'webfonts') {
// Load the library.
$fontawesome_library = \Drupal::service('library.discovery')
->getLibraryByName('fontawesome', 'fontawesome.webfonts');
// Attach it's CSS.
$css[] = $fontawesome_library['css'][0]['data'];
// Attach the shim CSS if needed.
if (Drupal::config('fontawesome.settings')
->get('use_shim')) {
// Load the library.
$fontawesome_library_shim = \Drupal::service('library.discovery')
->getLibraryByName('fontawesome', 'fontawesome.webfonts.shim');
// Attach it's CSS.
$css[] = $fontawesome_library_shim['css'][0]['data'];
}
}
}