Recent

Blocksclass

Blocks

Class to handle Knowledge Base blocks registration and rendering.

Namespace: WebberZone\Knowledge_Base\Blocks
Since: 2.3.0
Source: includes/blocks/class-blocks.php line 26

Methods

__construct()

Initialize the class and set up hooks

Since: 2.3.0
Line: 71

public function __construct(  );

register_blocks()

Registers the block using the metadata loaded from the block.json file. Behind the scenes, it registers also all assets so they can be enqueued through the block editor in the corresponding context.

Since: 2.3.0
Line: 84

public function register_blocks(  );

register_block_category()

Register custom block category for Knowledge Base blocks.

Since: 3.0.0
Line: 156

public function register_block_category( $categories ): array;
Type Name Description
array $categories Array of block categories.

Returns: array — Modified array of block categories.

enqueue_editor_settings()

Enqueue the editor settings script so KB blocks can access shared options.

Since: 3.0.0
Line: 186

public function enqueue_editor_settings(  ): void;

Returns: void

render_kb_block()

Renders the knowledgebase/knowledgebase block on server.

Since: 2.3.0
Line: 408

public function render_kb_block( $attributes ): string;
Type Name Description
array $attributes The block attributes.

Returns: string — Returns the post content with latest posts added.

render_alerts_block()

Renders the knowledgebase/alerts block on server.

Since: 2.3.0
Line: 453

public function render_alerts_block( $attributes, $content ): string;
Type Name Description
array $attributes The block attributes.
string $content The block content.

Returns: string — Returns the post content with latest posts added.

render_articles_block()

Renders the knowledgebase/articles block on server.

Since: 2.3.0
Line: 466

public function render_articles_block( $attributes ): string;
Type Name Description
array $attributes The block attributes.

Returns: string — Returns the post content with latest posts added.

render_breadcrumb_block()

Render the block.

Since: 2.3.0
Line: 504

public function render_breadcrumb_block( $attributes ): string;
Type Name Description
array $attributes Block attributes.

Returns: string — Rendered block output.

render_sections_block()

Renders the knowledgebase/sections block on server.

Since: 2.3.0
Line: 525

public function render_sections_block( $attributes ): string;
Type Name Description
array $attributes The block attributes.

Returns: string — Returns the sections list.

render_products_block()

Renders the knowledgebase/products block on server.

Since: 3.0.0
Line: 574

public function render_products_block( $attributes ): string;
Type Name Description
array $attributes The block attributes.

Returns: string — Returns the rendered product sections list.

Renders the knowledgebase/related block on server.

Since: 3.0.0
Line: 619

public function render_related_block( $attributes ): string;
Type Name Description
array $attributes The block attributes.

Returns: string — Returns the related articles list.

render_search_block()

Renders the knowledgebase/search block on server.

Since: 3.0.0
Line: 679

public function render_search_block( $attributes ): string;
Type Name Description
array $attributes The block attributes.

Returns: string — Returns the search form HTML.