GC_Block_Type::set_props()
最后更新于:2021-11-26 11:09:14
GC_Block_Type::set_props( array|string$args)Sets block type properties.
参数
- $args
-
(array|string) (Required) Array or string of arguments for registering a block type. See GC_Block_Type::__construct() for information on accepted arguments.
源文件
文件: gc-includes/class-gc-block-type.php
public function set_props( $args ) {
$args = gc_parse_args(
$args,
array(
'render_callback' => null,
)
);
$args['name'] = $this->name;
/**
* Filters the arguments for registering a block type.
*
* @since 5.5.0
*
* @param array $args Array of arguments for registering a block type.
* @param string $block_type Block type name including namespace.
*/
$args = apply_filters( 'register_block_type_args', $args, $this->name );
foreach ( $args as $property_name => $property_value ) {
$this->$property_name = $property_value;
}
}