Change Drupal 8 'Powered By' block | Drupal 8

Change Drupal 8 'Powered By' block

Submitted by editor on Tue, 05/31/2016 - 13:30
Question

How to edit the Drupal 8 system's "Powered By" block ?

You can't change the body of this block fron the user interface. But you can do that using a small custom module using hook_block_view_alter().

Example: in the yourmodule.module

function yourmodule_block_view_alter(array &$build, \Drupal\Core\Block\BlockPluginInterface $block) {
  if ($block->getBaseId() === 'system_powered_by_block') {
    $build['#pre_render'][] = '_yourmodule_block_poweredby_prerender';
  }
}

function _yourmodule_block_poweredby_prerender(array $build) {
    $build['content']['#markup'] = 'Your text';
    return $build;
}

Then clear the cache

NOTE: You can also remove the system 'Powered by Drupal' block and replace by a custom block.

Comments

Eva (not verified)

Tue, 01/23/2018 - 11:09

I liked your module.very useful. I have to try this. Thank you for sharing.expecting much module from you.Use <a href="https://www.custompapersonline.org/"> go to this website </a>website for academic work.

Juan Becker (not verified)

Mon, 02/19/2018 - 09:55

Hello here I'm Juan Becker. I am working as a professor, And also I'm very interested in Writing field. First of all Thank you for this blog.  I liked your module its very useful and it made me happy and confident.I expect more  informational blog from your side. I hope I will see a new and informative blog as soon as possible. Now I'm going to share my website with you, which is related to educational field like, Essay writing. 
http://www.quickcustomessaywriting.com/

Add new comment