function _system_update_create_block in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/system/system.install \_system_update_create_block()
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.
4 calls to _system_update_create_block()
- system_update_8005 in core/
modules/ system/ system.install - Place local actions and tasks blocks in every theme.
- system_update_8006 in core/
modules/ system/ system.install - Place branding blocks in every theme.
- system_update_8010 in core/
modules/ system/ system.install - Place page title blocks in every theme.
- system_update_8011 in core/
modules/ system/ system.install - Add secondary local tasks block to Seven (fixes system_update_8005).
File
- core/
modules/ system/ system.install, line 1578 - 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();
}
}