Shortcode_Block
A Gutenberg Block that acts as a wrapper for a shortcode.
- Full name:
\BigCommerce\Editor\Gutenberg\Blocks\Shortcode_Block
- Parent class:
\BigCommerce\Editor\Gutenberg\Blocks\Gutenberg_Block
- This class is an Abstract class
Properties
assets_url
URL for the assets.
protected string $assets_url
shortcode
The shortcode associated with the block.
protected string $shortcode
icon
The icon for the block.
protected string $icon
category
The category under which the block is listed.
protected string $category
Methods
__construct
Constructor for the block, setting the assets URL.
public __construct(string $assets_url): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$assets_url | string | The URL for assets. |
image_url
Generates the image URL for the given file.
protected image_url(string $file): string
Parameters:
Parameter | Type | Description |
---|---|---|
$file | string | The image file name. |
Return Value:
The complete URL to the image.
render
Renders the block. The default behavior is to convert the block into a shortcode, which will then be rendered by do_shortcode.
public render(array $attributes): string
Parameters:
Parameter | Type | Description |
---|---|---|
$attributes | array | The block attributes. |
Return Value:
The rendered block content.
js_config
Returns the JavaScript configuration for the block.
public js_config(): array
Return Value:
The block’s JS configuration.
title
Returns the title for the block.
protected title(): string
- This method is abstract.
Return Value:
The block’s title.
icon
Returns the icon for the block.
protected icon(): string
Return Value:
The icon for the block.
category
Returns the category for the block.
protected category(): string
Return Value:
The category for the block.
keywords
Returns an array of keywords for the block.
protected keywords(): array
Return Value:
The block’s keywords.
shortcode
Returns the shortcode associated with the block.
protected shortcode(): string
Return Value:
The shortcode for the block.
html_title
Returns the HTML title for the block.
protected html_title(): string
- This method is abstract.
Return Value:
The HTML title for the block.
html_image
Returns the HTML image for the block.
protected html_image(): string
- This method is abstract.
Return Value:
The HTML image for the block.
Inherited methods
__construct
Gutenberg_Block constructor.
public __construct(): mixed
Ensures that the extending class defines a NAME constant.
Throws:
If NAME constant is not set in the extending class.
name
Returns the name of the block.
public name(): string
Return Value:
The name of the block.
register
Registers the block with Gutenberg.
public register(): void
registration_args
Returns the arguments for registering the block.
protected registration_args(): array
Return Value:
The block registration arguments.
render
Render the block to a string. This is called from do_blocks()
,
which runs on the the_content
filter.
public render(array $attributes): string
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$attributes | array | The block attributes. |
Return Value:
The HTML output of the block.
See Also:
- \BigCommerce\Editor\Gutenberg\Blocks\do_blocks() - * \BigCommerce\Editor\Gutenberg\Blocks\the_content -
attributes
Returns the block’s attributes.
protected attributes(): array
Return Value:
The block attributes.
js_config
Returns the configuration data to pass to the front-end.
public js_config(): array
- This method is abstract.
Return Value:
The configuration data.
Automatically generated on 2025-01-21