PluginProbe
Gutenberg / 23.5.2
Gutenberg v23.5.2
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / packages / block-serialization-default-parser / class-wp-block-parser-block.php

class-wp-block-parser-block.php in Gutenberg 23.5.2, at packages/block-serialization-default-parser/class-wp-block-parser-block.php

91 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Block Serialization Parser
4 *
5 * @package WordPress
6 */
7
8 /**
9 * Class WP_Block_Parser_Block
10 *
11 * Holds the block structure in memory
12 *
13 * @since 5.0.0
14 */
15 class WP_Block_Parser_Block {
16 /**
17 * Name of block
18 *
19 * @example "core/paragraph"
20 *
21 * @since 5.0.0
22 * @var string
23 */
24 public $blockName; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
25
26 /**
27 * Optional set of attributes from block comment delimiters
28 *
29 * @example null
30 * @example array( 'columns' => 3 )
31 *
32 * @since 5.0.0
33 * @var array|null
34 */
35 public $attrs;
36
37 /**
38 * List of inner blocks (of this same class)
39 *
40 * @since 5.0.0
41 * @var WP_Block_Parser_Block[]
42 */
43 public $innerBlocks; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
44
45 /**
46 * Resultant HTML from inside block comment delimiters
47 * after removing inner blocks
48 *
49 * @example "...Just <!-- wp:test /--> testing..." -> "Just testing..."
50 *
51 * @since 5.0.0
52 * @var string
53 */
54 public $innerHTML; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
55
56 /**
57 * List of string fragments and null markers where inner blocks were found
58 *
59 * @example array(
60 * 'innerHTML' => 'BeforeInnerAfter',
61 * 'innerBlocks' => array( block, block ),
62 * 'innerContent' => array( 'Before', null, 'Inner', null, 'After' ),
63 * )
64 *
65 * @since 5.0.0
66 * @var array
67 */
68 public $innerContent; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
69
70 /**
71 * Constructor.
72 *
73 * Will populate object properties from the provided arguments.
74 *
75 * @since 5.0.0
76 *
77 * @param string $name Name of block.
78 * @param array $attrs Optional set of attributes from block comment delimiters.
79 * @param array $inner_blocks List of inner blocks (of this same class).
80 * @param string $inner_html Resultant HTML from inside block comment delimiters after removing inner blocks.
81 * @param array $inner_content List of string fragments and null markers where inner blocks were found.
82 */
83 public function __construct( $name, $attrs, $inner_blocks, $inner_html, $inner_content ) {
84 $this->blockName = $name; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
85 $this->attrs = $attrs;
86 $this->innerBlocks = $inner_blocks; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
87 $this->innerHTML = $inner_html; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
88 $this->innerContent = $inner_content; // phpcs:ignore WordPress.NamingConventions.ValidVariableName
89 }
90 }
91