You are here

function gutenberg_library_info_alter in Gutenberg 8

Same name and namespace in other branches
  1. 8.2 gutenberg.module \gutenberg_library_info_alter()

Implements hook_library_info_alter().

File

./gutenberg.module, line 1064
Provides integration with the Gutenberg editor.

Code

function gutenberg_library_info_alter(&$libraries, $extension) {
  if ($extension === 'gutenberg') {
    $moduleHandler = \Drupal::moduleHandler();
    $js_files_edit = [];
    $css_files_edit = [];
    $css_files_view = [];
    $moduleHandler
      ->alter('gutenberg_blocks', $js_files_edit, $css_files_edit, $css_files_view);
    foreach ($js_files_edit as $file) {
      $libraries['blocks-edit']['js'][$file] = [];
    }
    foreach ($css_files_edit as $file) {
      $libraries['blocks-edit']['css']['base'][$file] = [];
    }
    foreach ($css_files_view as $file) {
      $libraries['blocks-edit']['css']['base'][$file] = [];
      $libraries['blocks-view']['css']['base'][$file] = [];
    }
  }
}