1.20.x layout.api.php hook_layout_presave(Layout $layout)

Act on a layout being inserted or updated.

This hook is invoked from Layout::save() before the layout is saved to configuration.

Parameters

Layout $layout: The layout that is being inserted or updated.

Related topics

File

modules/layout/layout.api.php, line 331
Describe hooks provided by the Layout module.

Code

function hook_layout_presave(Layout $layout) {
  if ($layout->name == 'default') {
    $my_block_uuid = get_my_uuid();
    $my_block = $layout->content[$my_block_uuid];
    $my_block->data['settings']['title'] = 'New Title';
  }
}