Color_Picker extends React_Term
Display a color picker on product attributes.
Table of Contents
- $file_name : string
- Name of the file that will be enqueued.
- $json_accessor : string
- The name of the constant that holds the json data for the frontend.
- $plugin : Licensed_Plugin
- Plugin instance.
- __construct() : mixed
- Get things started.
- assets() : void
- Enqueue assets for this specific field type.
- created_term() : void
- When the attribute is saved, save the color details into the database.
- output() : void
- Renders the picker dom element.
- output_edit() : void
- Renders the picker dom element on the term edit.
- register() : void
- Hook into WP.
- register_into_attribute_forms() : void
- Find WC attributes and display out custom field for the picker.
- should_enqueue() : bool
- Determine if the react assets should enqueue.
- is_edit_page() : bool
- Determine if we're viewing the edit page of a term.
- input() : void
- Print the color picker field.
Properties
$file_name
Name of the file that will be enqueued.
public
string
$file_name
= 'wcf-attribute-color'
Name only, without the extension.
$json_accessor
The name of the constant that holds the json data for the frontend.
public
string
$json_accessor
$plugin
Plugin instance.
public
Licensed_Plugin
$plugin
Methods
__construct()
Get things started.
public
__construct(Licensed_Plugin $plugin) : mixed
Parameters
- $plugin : Licensed_Plugin
Return values
mixed —assets()
Enqueue assets for this specific field type.
public
assets() : void
Return values
void —created_term()
When the attribute is saved, save the color details into the database.
public
created_term(string $term_id, string $tt_id, string $taxonomy) : void
Parameters
- $term_id : string
- $tt_id : string
- $taxonomy : string
Return values
void —output()
Renders the picker dom element.
public
output() : void
Return values
void —output_edit()
Renders the picker dom element on the term edit.
public
output_edit(WP_Term $term, string $taxonomy) : void
Parameters
- $term : WP_Term
- $taxonomy : string
Return values
void —register()
Hook into WP.
public
register() : void
Return values
void —register_into_attribute_forms()
Find WC attributes and display out custom field for the picker.
public
register_into_attribute_forms() : void
Return values
void —should_enqueue()
Determine if the react assets should enqueue.
public
should_enqueue() : bool
Return values
bool —is_edit_page()
Determine if we're viewing the edit page of a term.
protected
is_edit_page() : bool
Return values
bool —input()
Print the color picker field.
private
input([string $value = null ][, mixed $label = true ]) : void
Parameters
- $value : string = null
-
optional input value
- $label : mixed = true