1 layout.module layout_layout_presave($layout)

Implements hook_layout_presave().

File

core/modules/layout/layout.module, line 2507
The Layout module creates pages and wraps existing pages in layouts.

Code

function layout_layout_presave($layout) {
  if (!empty($layout->removed_blocks)) {
    foreach ($layout->removed_blocks as $uuid => $block) {
      // @todo: Follow-up for other block types with files/images.
      if (is_a($block, 'BlockHero')) {
        if (!empty($block->settings['image'])) {
          $image = file_load($block->settings['image']);
          if ($image) {
            file_usage_delete($image, 'layout', 'block', $image->fid);
          }
        }
      }
    }
  }
}