ClarksonCore

Block_Type extends WP_Block_Type
in package

This custom block overwrites the render callback to use twig files.

It is automatically injected into all registered blocks at render time.

Table of Contents

__construct()  : mixed
Replaces the original block render function, and saves the original render function in case we can't find a fitting twig file.
clarkson_render_callback()  : string
Tries to find a twig file to use for rendering. If the twig file doesn't exists it falls back to the original render callback.
get_twig_template_path()  : string
Allows filtering of the path where this blocks twig file is found.

Methods

__construct()

Replaces the original block render function, and saves the original render function in case we can't find a fitting twig file.

public __construct(string $block_type[, array<string|int, mixed>|string $args = array() ]) : mixed
Parameters
$block_type : string

Block type name including namespace.

$args : array<string|int, mixed>|string = array()

Optional. Array or string of arguments for registering a block type.

Return values
mixed

clarkson_render_callback()

Tries to find a twig file to use for rendering. If the twig file doesn't exists it falls back to the original render callback.

public clarkson_render_callback(array<string|int, mixed> $attributes, string $content) : string
Parameters
$attributes : array<string|int, mixed>

Block attributes.

$content : string

Block content.

Return values
string

Rendered block type output.

get_twig_template_path()

Allows filtering of the path where this blocks twig file is found.

public get_twig_template_path() : string
Return values
string

        

Search results