_system_update_create_block($name, $theme_name, array $values)
Helper function to create block configuration objects for an update.
Parameters
string $name: The name of the config object.
string $theme_name: The name of the theme the block is associated with.
array $values: The block config values.
File
- core/modules/system/system.install, line 1409
- Install, update and uninstall functions for the system module.
Code
function _system_update_create_block($name, $theme_name, array $values) { if (!\Drupal::service('config.storage')->exists($name)) { $block = \Drupal::configFactory()->getEditable($name); $values['uuid'] = \Drupal::service('uuid')->generate(); $values['theme'] = $theme_name; $values['dependencies.theme'] = [$theme_name]; foreach ($values as $key => $value) { $block->set($key, $value); } $block->save(); } }
Please login to continue.