quickedit_library_info_alter(&$libraries, $extension)
Implements hook_library_info_alter().
Includes additional stylesheets defined by the admin theme to allow it to customize the Quick Edit toolbar appearance.
An admin theme can specify CSS files to make the front-end administration experience of in-place editing match the administration experience in the back-end.
The CSS files can be specified via the "edit_stylesheets" property in the .info.yml file:
1 2 | quickedit_stylesheets: - css/quickedit.css |
File
- core/modules/quickedit/quickedit.module, line 74
- Provides in-place content editing functionality for fields.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | function quickedit_library_info_alter(& $libraries , $extension ) { if ( $extension === 'quickedit' && isset( $libraries [ 'quickedit' ])) { $theme = Drupal::config( 'system.theme' )->get( 'admin' ); // First let the base theme modify the library, then the actual theme. $alter_library = function (& $library , $theme ) use (& $alter_library ) { if (isset( $theme ) && $theme_path = drupal_get_path( 'theme' , $theme )) { $info = system_get_info( 'theme' , $theme ); // Recurse to process base theme(s) first. if (isset( $info [ 'base theme' ])) { $alter_library ( $library , $info [ 'base theme' ]); } if (isset( $info [ 'quickedit_stylesheets' ])) { foreach ( $info [ 'quickedit_stylesheets' ] as $path ) { $library [ 'css' ][ 'theme' ][ '/' . $theme_path . '/' . $path ] = []; } } } }; $alter_library ( $libraries [ 'quickedit' ], $theme ); } } |
Please login to continue.