Drupal 9 How To Pass Arguments To Custom Blocks

[Solved] Drupal 9 How To Pass Arguments To Custom Blocks | Php Frameworks Drupal - Code Explorer | yomemimo.com
Question : Drupal 9 how to pass arguments to custom blocks

Answered by : dave-oukrqevg8554

$block_vals = [
'campaign_id' => $camp_id, 'campaign_hash' => $camp_hash
];
// block manager service available in this example at $this->bm
$ra = $this->bm->createInstance('your_block_id', $block_vals)->build();

Source : | Last Update : Fri, 20 Aug 21

Answers related to Drupal 9 how to pass arguments to custom blocks

Code Explorer Popular Question For Php Frameworks Drupal