private static function Blocks::updateInstancePropertiesSilent in Hook Update Deploy Tools 7
Updates a block with any specified properties.
Parameters
string $module: The machine name of the module that created the block. Use 'block' if was one created in the block UI.
string $block_delta: the block delta (machine name of the block)
string $theme: The name of the theme to target. Defaults to default theme.
array $block_properties: An array keyed with one or more of the following elements. status: bool weight: pos or neg numbers region: the name or number of the region. visibility: pages: list of page URL(s) to place the block on. title: the administrative title of the block. cache:
3 calls to Blocks::updateInstancePropertiesSilent()
- Blocks::disable in src/
Blocks.php - Disables a block for a specific theme.
- Blocks::enable in src/
Blocks.php - Enables and sets the region for a block in a specific theme.
- Blocks::updateInstanceProperties in src/
Blocks.php - Updates a block with any specified properties.
File
- src/
Blocks.php, line 286
Class
- Blocks
- Public methods for working with Blocks.
Namespace
HookUpdateDeployToolsCode
private static function updateInstancePropertiesSilent($module, $block_delta, $theme, $block_properties) {
// Prepare any params.
$theme = !empty($theme) ? $theme : variable_get('theme_default', NULL);
Check::notEmpty('$theme', $theme);
Check::notEmpty('$module', $module);
Check::notEmpty('$delta', $block_delta);
if (!empty($block_properties['region'])) {
// If the region is set to none, then the status must be disabled.
$block_properties['status'] = (int) ($block_properties['region'] != \BLOCK_REGION_NONE);
}
$keys = array(
'theme' => $theme,
'delta' => $block_delta,
'module' => $module,
);
$query = db_merge('block')
->key($keys)
->fields($block_properties)
->execute();
}