ProductTemplate
in package
The Product Template that represents the relation between the Product and the LayoutTemplate (ProductFormTemplateInterface)
Tags
Table of Contents
- $description : string
- The template description.
- $icon : string
- The template icon.
- $id : string
- The template id.
- $is_selectable_by_user : bool
- If the template is directly selectable through the UI.
- $layout_template_id : string
- The layout template id.
- $order : int
- The template order.
- $product_data : array<string|int, mixed>
- The product data.
- $title : string
- The template title.
- __construct() : mixed
- ProductTemplate constructor
- get_description() : string
- Get the template description.
- get_icon() : string
- Get the template icon.
- get_id() : string
- Get the template ID.
- get_is_selectable_by_user() : bool
- Get the selectable attribute.
- get_layout_template_id() : string
- Get the layout template ID.
- get_order() : int
- Get the template order.
- get_product_data() : array<string|int, mixed>
- Get the product data.
- get_title() : string
- Get the template title.
- set_description() : mixed
- Set the template description.
- set_icon() : mixed
- Set the template icon.
- set_layout_template_id() : mixed
- Set the layout template ID.
- set_order() : mixed
- Set the template order.
- to_json() : array<string|int, mixed>
- Get the product template as JSON like.
Properties
$description
The template description.
private
string
$description
= null
$icon
The template icon.
private
string
$icon
= null
$id
The template id.
private
string
$id
$is_selectable_by_user
If the template is directly selectable through the UI.
private
bool
$is_selectable_by_user
= true
$layout_template_id
The layout template id.
private
string
$layout_template_id
= null
$order
The template order.
private
int
$order
= 999
$product_data
The product data.
private
array<string|int, mixed>
$product_data
$title
The template title.
private
string
$title
Methods
__construct()
ProductTemplate constructor
public
__construct(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
-
The data.
Return values
mixed —get_description()
Get the template description.
public
get_description() : string
Return values
string — The description.get_icon()
Get the template icon.
public
get_icon() : string
Return values
string — The icon.get_id()
Get the template ID.
public
get_id() : string
Return values
string — The ID.get_is_selectable_by_user()
Get the selectable attribute.
public
get_is_selectable_by_user() : bool
Return values
bool — Selectable.get_layout_template_id()
Get the layout template ID.
public
get_layout_template_id() : string
Return values
string — The layout template ID.get_order()
Get the template order.
public
get_order() : int
Return values
int — The order.get_product_data()
Get the product data.
public
get_product_data() : array<string|int, mixed>
Return values
array<string|int, mixed> — The product data.get_title()
Get the template title.
public
get_title() : string
Return values
string — The title.set_description()
Set the template description.
public
set_description(string $description) : mixed
Parameters
- $description : string
-
The template description.
Return values
mixed —set_icon()
Set the template icon.
public
set_icon(string $icon) : mixed
Parameters
- $icon : string
-
The icon name from the @wordpress/components or a url for an external image resource.
Tags
Return values
mixed —set_layout_template_id()
Set the layout template ID.
public
set_layout_template_id(string $layout_template_id) : mixed
Parameters
- $layout_template_id : string
-
The layout template ID.
Return values
mixed —set_order()
Set the template order.
public
set_order(int $order) : mixed
Parameters
- $order : int
-
The template order.
Return values
mixed —to_json()
Get the product template as JSON like.
public
to_json() : array<string|int, mixed>