function block_content_test_block_content_presave

Same name in other branches
  1. 9 core/modules/block_content/tests/modules/block_content_test/block_content_test.module \block_content_test_block_content_presave()
  2. 8.9.x core/modules/block_content/tests/modules/block_content_test/block_content_test.module \block_content_test_block_content_presave()
  3. 10 core/modules/block_content/tests/modules/block_content_test/block_content_test.module \block_content_test_block_content_presave()

Implements hook_block_content_presave().

File

core/modules/block_content/tests/modules/block_content_test/block_content_test.module, line 28

Code

function block_content_test_block_content_presave(BlockContent $block_content) {
    if ($block_content->label() == 'testing_block_content_presave') {
        $block_content->setInfo($block_content->label() . '_presave');
    }
    // Determine changes.
    if (!empty($block_content->original) && $block_content->original
        ->label() == 'test_changes') {
        if ($block_content->original
            ->label() != $block_content->label()) {
            $block_content->setInfo($block_content->label() . '_presave');
            // Drupal 1.0 release.
            $block_content->changed = 979534800;
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.