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
Comment #2
lizuka commentedComment #3
lizuka commentedUpdating the code for the latest release (2.0.1)
Comment #4
lizuka commentedComment #5
lambert commentedI 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!