Drupal 9 - Read custom block body content:
$block = \Drupal\block\Entity\Block::load('block_machine_name');
if ($block) {
$blockuuid = $block->getPlugin()->getDerivativeId();
$blockContent = \Drupal::service('entity.repository')
->loadEntityByUuid('block_content', $blockuuid);
$vsf_form_message = $blockContent->get('body')->value;
}
Happy coding!
No comments:
Post a Comment