library_manager-8.x-1.0/library_manager.install
library_manager.install
<?php /** * @file * Contains install and update functions for Library Manager. */ /** * Add new JS attributes to existing libraries. */ function library_manager_update_8205() { // Load all existing library definitions. $config_factory = \Drupal::service('config.factory'); $library_definitions = $config_factory->listAll('library_manager.library_definition.'); foreach ($library_definitions as $library_definition) { $config = $config_factory->getEditable($library_definition); // Update the configuration schema to include the new fields. if (!$config->get('attributes')) { $config->set('attributes', []); } if (!$config->get('typemodulecheck')) { $config->set('typemodulecheck', FALSE); } if (!$config->get('nomodulecheck')) { $config->set('nomodulecheck', FALSE); } // Save the updated configuration. $config->save(); } // Invalidate the cache to ensure changes take effect. \Drupal::service('cache.config')->invalidateAll(); } function library_manager_update_8206() { // Load all existing library definitions. $config_factory = \Drupal::service('config.factory'); $library_definitions = $config_factory->listAll('library_manager.library_definition.'); foreach ($library_definitions as $library_definition) { $config = $config_factory->getEditable($library_definition); $config->set('status', TRUE); // Save the updated configuration. $config->save(); } // Invalidate the cache to ensure changes take effect. \Drupal::service('cache.config')->invalidateAll(); }