How can I programmatically load and display all available blocks? $block = Drupal\block\Entity\Block::load($block_id);
ksm($block);


This code loads only one specific block. But how can I load and display all available blocks?
Using the service plugin.manager.block we will get all blocks available definition.

$blockManager = \Drupal::service('plugin.manager.block');

$contextRepository = \Drupal::service('context.repository');

// Get blocks definition

$definitions = $blockManager-&gt;getDefinitionsForContexts($contextRepository-&gt;getAvailableContexts());


To get details about one specific block you can use below code.

print_r($definitions['help_block']);