Following on the Block shortcode feature (See parent issue), I needed to add a Views Block shortcode.
I've added some attributes to check if the block comes from a view and changed the code accordingly.
New attributes:

// Merge with default attributes.
    $attributes = $this->getAttributes([
      'id' => '',
      'view' => 'full',
      'is_view' => 'false',
      'view_name' => NULL,
    ],
      $attributes
    );

Additional code:

if($attributes['is_view'] == true){
      $block_view = views_embed_view($attributes['view_name'], $attributes['id']);
      return drupal_render($block_view);
    }

Comments

lizuka created an issue. See original summary.

lizuka’s picture

StatusFileSize
new1.35 KB
lizuka’s picture

StatusFileSize
new1.34 KB

Updating the code for the latest release (2.0.1)

lizuka’s picture

Version: 8.x-1.x-dev » 2.0.1
lambert’s picture

I want to add support to this feature request.

A views shortcode, not just for a block, but for a view to appear in its natural place in the running text, would be a great addition to the shortcode ecosystem (I'm amazed that the various CK-editor implementations don't simply throw in appropriate shortcodes. Some of us like the rugged, bloat-free simplicity of text.)

Thank you!