PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / 2.1.6
bBlocks – Essential Gutenberg Blocks & Patterns Collection v2.1.6
2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.43 2.0.42 2.0.41 2.0.40 2.0.39 2.0.38 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 106 releases
b-blocks / build / toggle-content / render.php

render.php in bBlocks – Essential Gutenberg Blocks & Patterns Collection 2.1.6, at build/toggle-content/render.php

53 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 $id = wp_unique_id('bBlocksToggleContent-');
4
5 $inner_blocks = $block->parsed_block['innerBlocks'] ?? [];
6
7 $label_left = $attributes['label']['left'] ?? '';
8 $label_right = $attributes['label']['right'] ?? '';
9 $switch_type = $attributes['toggle']['switchType'] ?? 'rounded';
10
11 $panel_a_html = isset($inner_blocks[0]) ? render_block($inner_blocks[0]) : '';
12 $panel_b_html = isset($inner_blocks[1]) ? render_block($inner_blocks[1]) : '';
13
14 ?>
15 <div
16 <?php echo get_block_wrapper_attributes(); ?>
17 id="<?php echo esc_attr($id); ?>"
18 data-attributes="<?php echo esc_attr(wp_json_encode($attributes)); ?>"
19 >
20 <div class="b-blocks-toggle-content__wrapper is-a">
21 <div class="b-blocks-toggle-content__head">
22 <div class="b-blocks-toggle-content-switch__wrapper">
23 <span
24 class="b-blocks-toggle-content__label b-blocks-toggle-content__label--left"
25 data-toggle-target="a"
26 >
27 <?php echo wp_kses_post($label_left); ?>
28 </span>
29
30 <div
31 class="b-blocks-toggle-content__switch b-blocks-toggle-content-switch-<?php echo esc_attr($switch_type); ?>"
32 aria-label="<?php echo esc_attr__('Toggle content', 'b-blocks'); ?>"
33 data-toggle-switch
34 >
35 <div class="b-blocks-toggle-content__knob"></div>
36 </div>
37
38 <span
39 class="b-blocks-toggle-content__label b-blocks-toggle-content__label--right "
40 data-toggle-target="b"
41 >
42 <?php echo wp_kses_post($label_right); ?>
43 </span>
44 </div>
45 </div>
46
47 <div class="b-blocks-toggle-content__content">
48 <?php echo $panel_a_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- render_block() output is escaped by core. ?>
49 <?php echo $panel_b_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- render_block() output is escaped by core. ?>
50 </div>
51 </div>
52 </div>
53