bootstrap_layout_builder.install in Bootstrap Layout Builder 1.x
Same filename and directory in other branches
Installation and updating routines.
File
bootstrap_layout_builder.installView source
<?php
/**
* @file
* Installation and updating routines.
*/
use Drupal\Core\Config\FileStorage;
/**
* Creates the new Bootstrap Layout Builder settings.
*/
function bootstrap_layout_builder_update_8001() {
$path = drupal_get_path('module', 'bootstrap_layout_builder') . '/config/install';
$source = new FileStorage($path);
$config_name = 'bootstrap_layout_builder.settings';
/** @var \Drupal\Core\Config\StorageInterface $active_storage */
$active_storage = \Drupal::service('config.storage');
$active_storage
->write($config_name, $source
->read($config_name));
}
/**
* Import new configs for breakpoints, layouts and its options.
*/
function bootstrap_layout_builder_update_8002() {
// Enable the new dependency modules.
\Drupal::service('module_installer')
->install([
'media_library_form_element',
'media_library_theme_reset',
]);
// Re-import the default configs.
\Drupal::service('config.installer')
->installDefaultConfig('module', 'bootstrap_layout_builder');
}
/**
* Update entity definitions, necessary if notices appear on site status page.
*/
function bootstrap_layout_builder_update_8003() {
$blb_breakpoint_entity_type = \Drupal::entityTypeManager()
->getDefinition('blb_breakpoint');
$blb_layout_entity_type = \Drupal::entityTypeManager()
->getDefinition('blb_layout');
$blb_layout_option_entity_type = \Drupal::entityTypeManager()
->getDefinition('blb_layout_option');
$entityUpdateManager = \Drupal::entityDefinitionUpdateManager();
$entityUpdateManager
->installEntityType($blb_breakpoint_entity_type);
$entityUpdateManager
->installEntityType($blb_layout_entity_type);
$entityUpdateManager
->installEntityType($blb_layout_option_entity_type);
}
Functions
Name | Description |
---|---|
bootstrap_layout_builder_update_8001 | Creates the new Bootstrap Layout Builder settings. |
bootstrap_layout_builder_update_8002 | Import new configs for breakpoints, layouts and its options. |
bootstrap_layout_builder_update_8003 | Update entity definitions, necessary if notices appear on site status page. |