I created a new custom block type in /admin/structure/block/block-content/types to which I added two fields. Then, I created a block with that block type.
How can I programmatically load this block via code?
How do I get the values of its fields (x, an image field, and y, a text field)?
I tried this code, but it didn't work.
$block = \Drupal\block_content\Entity\BlockContent::load($bid); $render = \Drupal::entityManager()->getViewBuilder('block_content')->view($block);