final class Settings_Section

A class to automate the process of creating a section for a page under the 'settings' menu item.

Properties

protected Options_Page $Settings_Page
protected Settings_Field[] $Settings_Fields
string $section
string $label
string $description
array $inputs

Methods

get_settings_page()

Return the Settings Page instance.

get_settings_fields()

Return the Settings Field instances.

__construct(Options_Page $Settings_Page, string $section_name, array $args)

Set the initial values for the Settings Section.

string
get_section_name()

Create a reusable section ID.

string
get_section_option_name()

Generate the key to be used in the options table in the database.

mixed
load_option()

Load and return the option associated with this section.

render(array $args)

The template for displaying data about the section.

Details

at line 51
final Options_Page get_settings_page()

Return the Settings Page instance.

Return Value

Options_Page

$Settings_Page The Settings Page instance.

at line 58
final Settings_Field[] get_settings_fields()

Return the Settings Field instances.

Return Value

Settings_Field[]

$Settings_Fields The Settings Fields in this Section instance.

at line 74
__construct(Options_Page $Settings_Page, string $section_name, array $args)

Set the initial values for the Settings Section.

Parameters

Options_Page $Settings_Page

The parent Settings Page that these settings belong to.

string $section_name

The section identifier.

array $args

The optional arguments to pass to the Section.

at line 134
final string get_section_name()

Create a reusable section ID.

Return Value

string

An identifier for this section.

at line 143
final string get_section_option_name()

Generate the key to be used in the options table in the database.

Return Value

string

An identifier for this section.

at line 152
final mixed load_option()

Load and return the option associated with this section.

Return Value

mixed

The option data. Returns false if the data does not exist.

at line 161
final render(array $args)

The template for displaying data about the section.

Parameters

array $args

Arguments passed to the render function.