function block_post_update_make_weight_integer
Ensures that all block weights are integers.
File
-
core/
modules/ block/ block.post_update.php, line 26
Code
function block_post_update_make_weight_integer(array &$sandbox = []) : void {
\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'block', function (BlockInterface $block) : bool {
$weight = $block->getWeight();
if (!is_int($weight)) {
$block->setWeight($weight);
return TRUE;
}
return FALSE;
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.