Engine
in package
Class to be extended by page layout sub-classes.
Tags
Table of Contents
- $plugin_name : string
- The ID of this plugin.
- $sections : array<string|int, mixed>
- Stores all Sections for the child sub-page.
- $sub_page_hook : string|null
- Stores the Hook connection string for the child sub-page.
- description() : void
- Output the description of a section. May be overwritten in any section.
- display_content() : void
- Displays the content of specific sub-page.
- get_priority() : int
- Returns a Priority index. Lower numbers have a higher priority.
- register_sections() : void
- Registers all sections for a sub-page.
- register_sub_page() : void
- Registers a sub-page.
- add_checkbox() : string
- Constructs the HTML for a checkbox 'input' element.
- add_color_selection() : string
- Constructs the HTML for a text 'input' element with the colour selection class.
- add_label() : string
- Returns the HTML tag for a 'label' element.
- add_meta_box() : array<string|int, mixed>
- Returns an array describing a meta box.
- add_num_box() : string
- Constructs the HTML for numeric 'input' element.
- add_section() : array<string|int, mixed>
- Returns an array describing a sub-page section.
- add_select_box() : string
- Constructs the HTML for a 'select' element.
- add_text() : string
- Returns a simple text inside a 'span' element.
- add_text_box() : string
- Constructs the HTML for a text 'input' element.
- add_textarea() : string
- Constructs the HTML for a 'textarea' element.
- get_meta_boxes() : array<string|int, mixed>
- Returns an array of all registered meta boxes.
- get_sections() : array<string|int, mixed>
- Returns an array of all registered sections for a sub-page.
- get_sub_page_slug() : string
- Returns the unique slug of the child sub-page.
- get_sub_page_title() : string
- Returns the title of the child sub-page.
- load_setting() : array<string|int, mixed>
- Loads a specified setting.
- append_scripts() : void
- Append JavaScript and CSS files for specific sub-page.
- register_meta_boxes() : void
- Registers all Meta boxes for a sub-page.
- save_settings() : bool
- Save all plugin settings.
Properties
$plugin_name
The ID of this plugin.
protected
string
$plugin_name
The ID of this plugin.
Tags
$sections
Stores all Sections for the child sub-page.
protected
array<string|int, mixed>
$sections
= array()
Tags
$sub_page_hook
Stores the Hook connection string for the child sub-page.
protected
string|null
$sub_page_hook
= null
Tags
Methods
description()
Output the description of a section. May be overwritten in any section.
public
description() : void
Tags
Return values
void —display_content()
Displays the content of specific sub-page.
public
display_content() : void
Tags
Return values
void —get_priority()
Returns a Priority index. Lower numbers have a higher priority.
public
abstract get_priority() : int
Tags
Return values
int —register_sections()
Registers all sections for a sub-page.
public
register_sections() : void
Tags
Return values
void —register_sub_page()
Registers a sub-page.
public
register_sub_page() : void
Tags
Return values
void —add_checkbox()
Constructs the HTML for a checkbox 'input' element.
protected
add_checkbox(string $setting_name) : string
Parameters
- $setting_name : string
-
Setting key.
Tags
Return values
string —add_color_selection()
Constructs the HTML for a text 'input' element with the colour selection class.
protected
add_color_selection(string $setting_name) : string
Parameters
- $setting_name : string
-
Setting key.
Tags
Return values
string —add_label()
Returns the HTML tag for a 'label' element.
protected
add_label(string $setting_name, string $caption) : string
Parameters
- $setting_name : string
-
Settings key.
- $caption : string
-
Label caption.
Tags
Return values
string —add_meta_box()
Returns an array describing a meta box.
protected
add_meta_box(string $section_id, string $id, string $title, string $callback_function_name) : array<string|int, mixed>
Parameters
- $section_id : string
-
Parent section ID.
- $id : string
-
Unique ID suffix.
- $title : string
-
Title for the meta box.
- $callback_function_name : string
-
Class method name for callback.
Tags
Return values
array<string|int, mixed> —{ A dashboard meta box.
@type string $parent Parent section ID.
@type string $id Meta box ID.
@type string $title Meta box title.
@type string $callback Meta box callback function.
}
add_num_box()
Constructs the HTML for numeric 'input' element.
protected
add_num_box(string $setting_name, int $p_in_min, int $max[, bool $deci = false ]) : string
Parameters
- $setting_name : string
-
Setting key.
- $p_in_min : int
-
Minimum value.
- $max : int
-
Maximum value.
- $deci : bool = false
-
true
if float,false
if integer. Defaultfalse
.
Tags
Return values
string —add_section()
Returns an array describing a sub-page section.
protected
add_section(string $id, string $title, int $settings_container_index[, bool $has_submit_button = true ]) : array<string|int, mixed>
Parameters
- $id : string
-
Unique ID suffix.
- $title : string
-
Title of the section.
- $settings_container_index : int
-
Settings Container index.
- $has_submit_button : bool = true
-
Whether a ‘Submit’ button should be displayed for this section. Default
true
.
Tags
Return values
array<string|int, mixed> —{ A dashboard section.
@type string $id Section ID.
@type string $title Section title.
@type bool $submit Whether the section has a submit button or not.
@type int $container Settings Container index.
}
add_select_box()
Constructs the HTML for a 'select' element.
protected
add_select_box(string $setting_name, array<string|int, mixed> $options) : string
Parameters
- $setting_name : string
-
Setting key.
- $options : array<string|int, mixed>
-
Possible options.
Tags
Return values
string —add_text()
Returns a simple text inside a 'span' element.
protected
add_text(string $text) : string
Parameters
- $text : string
-
Message to be surrounded with
<span>
tags.
Tags
Return values
string —add_text_box()
Constructs the HTML for a text 'input' element.
protected
add_text_box(string $setting_name[, int $max_length = 999 ][, bool $readonly = false ][, bool $hidden = false ]) : string
Parameters
- $setting_name : string
-
Setting key.
- $max_length : int = 999
-
Maximum length of the input. Default length 999 chars.
- $readonly : bool = false
-
Set the input to be read only. Default
false
. - $hidden : bool = false
-
Set the input to be hidden. Default
false
.
Tags
Return values
string —add_textarea()
Constructs the HTML for a 'textarea' element.
protected
add_textarea(string $setting_name) : string
Parameters
- $setting_name : string
-
Setting key.
Tags
Return values
string —get_meta_boxes()
Returns an array of all registered meta boxes.
protected
abstract get_meta_boxes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —get_sections()
Returns an array of all registered sections for a sub-page.
protected
abstract get_sections() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —get_sub_page_slug()
Returns the unique slug of the child sub-page.
protected
abstract get_sub_page_slug() : string
Tags
Return values
string —get_sub_page_title()
Returns the title of the child sub-page.
protected
abstract get_sub_page_title() : string
Tags
Return values
string —load_setting()
Loads a specified setting.
protected
load_setting(string $setting_key_name) : array<string|int, mixed>
Parameters
- $setting_key_name : string
-
Setting key.
Tags
Return values
array<string|int, mixed> —{ A configurable setting.
@type string $id Setting key.
@type string $name Setting name.
@type string $value Setting value.
}
append_scripts()
Append JavaScript and CSS files for specific sub-page.
private
append_scripts() : void
Tags
Return values
void —register_meta_boxes()
Registers all Meta boxes for a sub-page.
private
register_meta_boxes(string $parent_id) : void
Parameters
- $parent_id : string
-
Parent section unique ID.
Tags
Return values
void —save_settings()
Save all plugin settings.
private
save_settings() : bool
Tags
Return values
bool —true
on save success, else false
.