How to programmatically load a rendered view exposed filter block I'm in Drupal 8 trying to load a Views Exposed Filter block based on its ID, similarly to how I would load a content block.

$bid = 'exposedformview_nameview_display_name'; // Found on mysite.test/admin/structure/block/manage/exposedformview_nameview_display_name/
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityManager()
        -&gt;getViewBuilder('block_content')
        -&gt;view($block);
return $render;


Nothing ends up printing out, and in the error log I see this message:


  Recoverable fatal error: Argument 1 passed to Drupal\block_content\BlockContentViewBuilder::view() must implement interface Drupal\Core\Entity\EntityInterface, null given


Sure enough, when I debug($block), it shows NULL.

I know this works for other blocks created in the content placement area, not sure why it wouldn't also work for views exposed filter blocks.  They are both available for placement in the manage blocks page.

EDIT: It seems as though it will not be possible to load the block like this.  This method depends on revisions being available for blocks.  There is no revision for a views exposed filter block so there must be another way to accomplish this.  Perhaps by loading the form directly.
The block content entity is not the block entity that is required there.

The actual block entity is a configuration entity. Use the \Drupal\block\Entity\Block::load method to load it.

Try the following:

$bid = 'exposedformview_nameview_display_name';
$block = \Drupal\block\Entity\Block::load($bid);
$render = \Drupal::entityTypeManager()
        -&gt;getViewBuilder('block')
        -&gt;view($block);
return $render;