I had code to programmatically render a block by programmatically.
$block = \Drupal\block\Entity\Block::load('bartik_search'); $block_content = \Drupal::entityManager() ->getViewBuilder('block') ->view($block); return array('#markup' => drupal_render($block_content)); $block = \Drupal\block\Entity\Block::load('bartik_search'); $block_content = \Drupal::entityManager() ->getViewBuilder('block') ->view($block); return array('#markup' => drupal_render($block_content)); That code working for major Drupal 8.1.x when updateAfter updating to Drupal 8.2.x had show, I get the following error:
"RecoverableRecoverable fatal error: Argument 1 passed to Drupal\block\BlockViewBuilder::view() must implement interface"interface
What's solution forHow do I fix this error?
Thanks