Issue #2580255 by Wim Leers: Remove (classy|seven)_library_info_alter() in favor of libraries-extend

8.0.x
Alex Pott 2015-10-05 13:45:31 +01:00
parent a47dd7adda
commit 2d1f427420
4 changed files with 23 additions and 44 deletions

View File

@ -8,3 +8,11 @@ core: 8.x
libraries:
- classy/base
- core/normalize
libraries-extend:
user/drupal.user:
- classy/user
core/drupal.dropbutton:
- classy/dropbutton
core/drupal.dialog:
- classy/dialog

View File

@ -1,26 +0,0 @@
<?php
/**
* @file
* Functions to support theming in the Classy theme.
*/
/**
* Implements hook_library_info_alter().
*/
function classy_library_info_alter(&$libraries, $extension) {
if ($extension == 'user' && isset($libraries['drupal.user'])) {
// @todo Replace with https://www.drupal.org/node/2497667 when possible.
$library_discovery = \Drupal::service('library.discovery');
$library = $library_discovery->getLibraryByName('classy', 'user');
foreach ($library['css'] as $css) {
$libraries['drupal.user']['css']['component'][base_path() . $css['data']] = [];
}
}
if ($extension == 'core' && isset($libraries['drupal.dropbutton'])) {
$libraries['drupal.dropbutton']['dependencies'][] = 'classy/dropbutton';
}
if ($extension == 'core' && isset($libraries['drupal.dialog'])) {
$libraries['drupal.dialog']['dependencies'][] = 'classy/dialog';
}
}

View File

@ -9,10 +9,25 @@ core: 8.x
libraries:
- seven/global-styling
libraries-override:
core/drupal.vertical-tabs:
css:
component:
misc/vertical-tabs.css: false
core/jquery.ui:
css:
theme:
assets/vendor/jquery.ui/themes/base/theme.css: false
core/jquery.ui.dialog:
css:
component:
assets/vendor/jquery.ui/themes/base/dialog.css: false
classy/dialog:
seven/seven.drupal.dialog
libraries-extend:
core/drupal.vertical-tabs:
- seven/vertical-tabs
core/jquery.ui:
- seven/seven.jquery.ui
quickedit_stylesheets:
- css/components/quickedit.css
regions:

View File

@ -187,21 +187,3 @@ function seven_form_node_form_alter(&$form, FormStateInterface $form_state) {
$form['revision_information']['#type'] = 'container';
$form['revision_information']['#group'] = 'meta';
}
/**
* Implements hook_library_info_alter().
*/
function seven_library_info_alter(&$libraries, $extension) {
if ($extension == 'core' && isset($libraries['drupal.vertical-tabs'])) {
unset($libraries['drupal.vertical-tabs']['css']['component']['misc/vertical-tabs.css']);
$libraries['drupal.vertical-tabs']['dependencies'][] = 'seven/vertical-tabs';
}
if ($extension == 'core' && isset($libraries['jquery.ui'])) {
unset($libraries['jquery.ui']['css']['theme']['assets/vendor/jquery.ui/themes/base/theme.css']);
$libraries['jquery.ui']['dependencies'][] = 'seven/seven.jquery.ui';
}
if ($extension == 'classy' && isset($libraries['dialog'])) {
unset($libraries['dialog']['css']['component']['css/components/dialog.css']);
$libraries['dialog']['dependencies'][] = 'seven/seven.drupal.dialog';
}
}