Views Block Shortcode

Created on 14 October 2020, over 3 years ago
Updated 29 March 2023, over 1 year ago

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);
    }
✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡«πŸ‡·France lizuka

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024