PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / trunk
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder vtrunk
2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 All 78 releases
ablocks / addons / theme-builder / shortcode.php

shortcode.php in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder trunk, at addons/theme-builder/shortcode.php

39 lines 1008 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ABlocksThemeBuilder;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 use ABlocksThemeBuilder\Traits\RenderContent;
9
10 class Shortcode {
11 use RenderContent;
12
13 public static function init() {
14 $self = new self();
15 add_shortcode( 'ablocks_template', [ $self, 'render_template' ] );
16 }
17 public function render_template( $attributes ) {
18 $attributes = shortcode_atts(
19 [
20 'id' => '',
21 ],
22 $attributes,
23 'ablocks_template'
24 );
25
26 $id = ! empty( $attributes['id'] ) ? apply_filters( 'ablocks/theme_builder/render_template_id', intval( $attributes['id'] ) ) : '';
27
28 if ( empty( $id ) ) {
29 return '';
30 }
31 add_filter( 'ablocks/is_allow_block_inline_assets', '__return_true' );
32 add_filter( 'ablocks/is_enabled_assets_generation', '__return_false' );
33 $content = $this->get_rendered_block_content_by_id( $id );
34 remove_filter( 'ablocks/is_allow_block_inline_assets', '__return_true' );
35 remove_filter( 'ablocks/is_enabled_assets_generation', '__return_false' );
36 return $content;
37 }
38 }
39