PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / trunk
bBlocks – Essential Gutenberg Blocks & Patterns Collection vtrunk
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 / timeline / render.php

render.php in bBlocks – Essential Gutenberg Blocks & Patterns Collection trunk, at build/timeline/render.php

45 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Timeline Block server-side render.
4 *
5 * Only the wrapper and the entries are written here — no classes and no
6 * styles. Both are applied on the client from the attributes forwarded in
7 * `data-attributes`: the wrapper's classes by Components/Frontend/Timeline.js
8 * and every style by Components/Common/Style.js, the same way the Data Table
9 * block renders.
10 *
11 * That leaves the class list with a single source of truth in
12 * utils/functions.js rather than a copy here that has to be kept in step.
13 *
14 * The entries are InnerBlocks, so they are rendered into a holder that
15 * view.js adopts into the React tree rather than re-creating.
16 *
17 * @package bBlocks
18 *
19 * @var array $attributes Block attributes.
20 * @var string $content Rendered inner blocks.
21 */
22
23 if ( ! defined( 'ABSPATH' ) ) {
24 exit;
25 }
26
27 $id = wp_unique_id( 'timeline-' );
28 ?>
29 <div
30 <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- get_block_wrapper_attributes() is properly escaped ?>
31 <?php echo get_block_wrapper_attributes(); ?>
32 id='<?php echo esc_attr( $id ); ?>'
33 data-attributes='<?php echo esc_attr( wp_json_encode( $attributes ) ); ?>'
34 >
35 <div class='b-blocks-timeline-innerBlocks-contents'>
36 <div class='b-blocks-timeline-items'>
37 <?php
38 // $content is the rendered inner blocks — a series of Timeline
39 // Items, each of which escaped its own output in its render.php.
40 echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- inner blocks render their own escaped markup
41 ?>
42 </div>
43 </div>
44 </div>
45