private static function Blocks::diff in Hook Update Deploy Tools 7
Compares two block objects and returns a messages array.
Parameters
object $block_original: The original block.
object $block_new: The new block after the save.
Return value
array An array of messages to be output indicating property value changes.
1 call to Blocks::diff()
- Blocks::updateInstanceProperties in src/
Blocks.php - Updates a block with any specified properties.
File
- src/
Blocks.php, line 21
Class
- Blocks
- Public methods for working with Blocks.
Namespace
HookUpdateDeployToolsCode
private static function diff($block_original, $block_new) {
$properties_changed = array_keys(array_diff((array) $block_original, (array) $block_new));
$messages = array();
foreach ($properties_changed as $property) {
$vars = array(
'@original' => $block_original->{$property},
'@new' => $block_new->{$property},
);
$messages[$property] = t('Changed from @original to @new', $vars);
}
$messages = empty($messages) ? 'nothing' : $messages;
return $messages;
}