BlockRenderAlterContent.php

Same filename in other branches
  1. 9 core/modules/block/tests/modules/block_test/src/BlockRenderAlterContent.php
  2. 10 core/modules/block/tests/modules/block_test/src/BlockRenderAlterContent.php
  3. 11.x core/modules/block/tests/modules/block_test/src/BlockRenderAlterContent.php

Namespace

Drupal\block_test

File

core/modules/block/tests/modules/block_test/src/BlockRenderAlterContent.php

View source
<?php

namespace Drupal\block_test;

use Drupal\Core\Render\Element\RenderCallbackInterface;

/**
 * Implements a trusted preRender callback.
 */
class BlockRenderAlterContent implements RenderCallbackInterface {
    
    /**
     * #pre_render callback for a block to alter its content.
     */
    public static function preRender(array $build) {
        $build['#prefix'] = 'Hiya!<br>';
        return $build;
    }

}

Classes

Title Deprecated Summary
BlockRenderAlterContent Implements a trusted preRender callback.

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