[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> class-wp-block-type.php (summary)

Blocks API: WP_Block_Type class

File Size: 407 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_Block_Type:: (6 methods):
  __construct()
  render()
  is_dynamic()
  prepare_attributes_for_render()
  set_props()
  get_attributes()


Class: WP_Block_Type  - X-Ref

Core class representing a block type.

__construct( $block_type, $args = array()   X-Ref
Constructor.

Will populate object properties from the provided arguments.

param: string       $block_type Block type name including namespace.
param: array|string $args       {
since: 5.0.0
since: 5.5.0 Added the `title`, `category`, `parent`, `icon`, `description`,
since: 5.6.0 Added the `api_version` property.
since: 5.8.0 Added the `variations` property.
since: 5.9.0 Added the `view_script` property.
since: 6.0.0 Added the `ancestor` property.

render( $attributes = array()   X-Ref
Renders the block type output for given attributes.

return: string Rendered block type output.
param: array  $attributes Optional. Block attributes. Default empty array.
param: string $content    Optional. Block content. Default empty string.
since: 5.0.0

is_dynamic()   X-Ref
Returns true if the block type is dynamic, or false otherwise. A dynamic
block is one which defers its rendering to occur on-demand at runtime.

return: bool Whether block type is dynamic.
since: 5.0.0

prepare_attributes_for_render( $attributes )   X-Ref
Validates attributes against the current block schema, populating
defaulted and missing values.

return: array Prepared block attributes.
param: array $attributes Original block attributes.
since: 5.0.0

set_props( $args )   X-Ref
Sets block type properties.

param: array|string $args Array or string of arguments for registering a block type.
since: 5.0.0

get_attributes()   X-Ref
Get all available block attributes including possible layout attribute from Columns block.

return: array Array of attributes.
since: 5.0.0



Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1