You are here

public static function Blocks::updateInstanceProperties 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:

Return value

string message for hook_update_N().

File

src/Blocks.php, line 250

Class

Blocks
Public methods for working with Blocks.

Namespace

HookUpdateDeployTools

Code

public static function updateInstanceProperties($module, $block_delta, $theme, $block_properties) {
  $block_original = self::load($module, $block_delta, $theme);
  self::updateInstancePropertiesSilent($module, $block_delta, $theme, $block_properties);
  $block_new = self::load($module, $block_delta, $theme);
  $diff = self::diff($block_original, $block_new);
  $vars = array(
    '@module' => $module,
    '@delta' => $block_delta,
    '@theme' => $theme,
    '!diff' => $diff,
  );
  $message = 'The block @module:@delta in theme:@theme updated !diff';
  return Message::make($message, $vars, WATCHDOG_INFO, 1);
}