You are here

function gin_lb_css_alter in Gin Layout Builder 1.0.x

Implements hook_css_alter().

File

./gin_lb.module, line 739
Provides hooks for gin_lb module.

Code

function gin_lb_css_alter(&$css, AttachedAssetsInterface $assets) {
  $theme_handler = \Drupal::service('theme_handler');

  // Only target layout builder specific pages.
  if (gin_lb_is_layout_builder_route()) {
    $stable_themes = [
      'stable',
      'stable9',
    ];
    foreach ($stable_themes as $stable_theme) {
      if ($theme_handler
        ->themeExists($stable_theme)) {
        $stable_theme_css = drupal_get_path('theme', $stable_theme) . '/css';

        // Remove very specific CSS files that this module is overriding.
        unset($css[$stable_theme_css . '/layout_builder/layout-builder.css']);
        unset($css[$stable_theme_css . '/core/dialog/off-canvas.theme.css']);
        unset($css[$stable_theme_css . '/core/dialog/off-canvas.details.css']);
        unset($css[$stable_theme_css . '/core/dialog/off-canvas.reset.css']);
        unset($css[$stable_theme_css . '/core/dialog/off-canvas.base.css']);
        unset($css[$stable_theme_css . '/core/dialog/off-canvas.table.css']);
        unset($css[$stable_theme_css . '/core/dialog/off-canvas.tabledrag.css']);
        unset($css[$stable_theme_css . '/core/dialog/off-canvas.form.css']);
        unset($css[$stable_theme_css . '/core/dialog/off-canvas.button.css']);

        // unset($css[$stable_theme_css . '/core/vertical-tabs.css']);.
      }
    }
    unset($css['core/modules/layout_builder/css/layout-builder.css']);
    unset($css['core/modules/system/css/components/tabledrag.module.css']);
    unset($css['core/assets/vendor/jquery.ui/themes/base/dialog.css']);
    unset($css['core/misc/dialog/off-canvas.theme.css']);
    unset($css['core/misc/dialog/off-canvas.base.css']);
    unset($css['core/misc/dialog/off-canvas.reset.css']);
    unset($css['core/misc/dialog/off-canvas.table.css']);
    unset($css['core/misc/dialog/off-canvas.tabledrag.css']);
    unset($css['core/misc/dialog/off-canvas.details.css']);
    unset($css['core/misc/dialog/off-canvas.form.css']);
    unset($css['core/misc/dialog/off-canvas.button.css']);
    unset($css['core/assets/vendor/jquery.ui/themes/base/theme.css']);
  }
}