Recent

Blocks class

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: 147

public function register_block_category( $categories ): array;
TypeNameDescription
array$categoriesArray 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: 177

public function enqueue_editor_settings(  ): void;

Returns: void

render_kb_block()

Renders the knowledgebase/knowledgebase block on server.

Since: 2.3.0
Line: 392

public function render_kb_block( $attributes ): string;
TypeNameDescription
array$attributesThe 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: 437

public function render_alerts_block( $attributes, $content ): string;
TypeNameDescription
array$attributesThe block attributes.
string$contentThe 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: 450

public function render_articles_block( $attributes ): string;
TypeNameDescription
array$attributesThe block attributes.

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

render_breadcrumb_block()

Render the block.

Since: 2.3.0
Line: 488

public function render_breadcrumb_block( $attributes ): string;
TypeNameDescription
array$attributesBlock attributes.

Returns: string — Rendered block output.

render_sections_block()

Renders the knowledgebase/sections block on server.

Since: 2.3.0
Line: 509

public function render_sections_block( $attributes ): string;
TypeNameDescription
array$attributesThe block attributes.

Returns: string — Returns the sections list.

render_products_block()

Renders the knowledgebase/products block on server.

Since: 3.0.0
Line: 558

public function render_products_block( $attributes ): string;
TypeNameDescription
array$attributesThe block attributes.

Returns: string — Returns the rendered product sections list.

Renders the knowledgebase/related block on server.

Since: 3.0.0
Line: 603

public function render_related_block( $attributes ): string;
TypeNameDescription
array$attributesThe block attributes.

Returns: string — Returns the related articles list.

render_search_block()

Renders the knowledgebase/search block on server.

Since: 3.0.0
Line: 663

public function render_search_block( $attributes ): string;
TypeNameDescription
array$attributesThe block attributes.

Returns: string — Returns the search form HTML.