You are here

class BlockParserBlock in Gutenberg 8.2

Class BlockParserBlock.

This class was ported from the WordPress code.

@link https://github.com/WordPress/WordPress for the canonical source repository @copyright Copyright (c) 2011-2020 WordPress - Web publishing software. @license https://github.com/WordPress/WordPress/blob/master/license.txt GNU General Public License.

Holds the block structure in memory.

@since 3.8.0

Hierarchy

Expanded class hierarchy of BlockParserBlock

See also

https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-...

File

src/Parser/BlockParserBlock.php, line 19

Namespace

Drupal\gutenberg\Parser
View source
class BlockParserBlock {

  /**
   * Name of block.
   *
   * @var string
   * @since 3.8.0
   * @example "core/paragraph"
   */
  public $blockName;

  /**
   * Optional set of attributes from block comment delimiters.
   *
   * @var array|null
   * @example array( 'columns' => 3 )
   *
   * @since 3.8.0
   */
  public $attrs;

  /**
   * List of inner blocks (of this same class)
   *
   * @var BlockParserBlock[]
   * @since 3.8.0
   */
  public $innerBlocks;

  /**
   * HTML from inside block comment delimiters after removing inner blocks.
   *
   * @var string
   * @since 3.8.0
   * @example "...Just <!-- wp:test /--> testing..." -> "Just testing..."
   */
  public $innerHTML;

  /**
   * List of string fragments and null markers where inner blocks were found.
   *
   * @var array
   * @since 4.2.0
   * @example array(
   *   'innerHTML'    => 'BeforeInnerAfter',
   *   'innerBlocks'  => array( block, block ),
   *   'innerContent' => array( 'Before', null, 'Inner', null, 'After' ),
   * )
   */
  public $innerContent;

  /**
   * Constructor.
   *
   * Will populate object properties from the provided arguments.
   *
   * @param string $name
   *   Name of block.
   * @param array $attrs
   *   Optional set of attributes from block comment delimiters.
   * @param array $inner_blocks
   *   List of inner blocks (of this same class).
   * @param string $inner_html
   *   Resultant HTML from inside block comment delimiters after
   *    removing inner blocks.
   * @param array $inner_content
   *   List of string fragments and null markers where inner blocks were found.
   *
   * @since 3.8.0
   */
  public function __construct($name, array $attrs, array $inner_blocks, $inner_html, array $inner_content) {
    $this->blockName = $name;
    $this->attrs = $attrs;
    $this->innerBlocks = $inner_blocks;
    $this->innerHTML = $inner_html;
    $this->innerContent = $inner_content;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlockParserBlock::$attrs public property Optional set of attributes from block comment delimiters.
BlockParserBlock::$blockName public property Name of block.
BlockParserBlock::$innerBlocks public property List of inner blocks (of this same class)
BlockParserBlock::$innerContent public property List of string fragments and null markers where inner blocks were found.
BlockParserBlock::$innerHTML public property HTML from inside block comment delimiters after removing inner blocks.
BlockParserBlock::__construct public function Constructor.