SettingsSectionRegistry
in package
Registry for sections that extensions add to existing WooCommerce settings pages.
Tags
Table of Contents
- $initialized : bool
- Whether the registration action has fired.
- $instance : SettingsSectionRegistry|null
- Singleton instance.
- $sections : array<string|int, mixed>
- Registered sections keyed by parent page id and section id.
- get_instance() : SettingsSectionRegistry
- Get the registry instance.
- get_registered() : SettingsSectionInterface|null
- Get a registered section.
- get_sections_for_page() : array<string, string>
- Get registered section labels for a settings page.
- register() : bool
- Register a settings section.
- unregister_all() : void
- Clear all registered sections.
- initialize() : void
- Fire the section registration action once.
- is_reserved_checkout_section_id() : bool
- Check whether a checkout section id is reserved by an existing payment gateway.
- normalize_id() : string
- Normalize page and section identifiers.
Properties
$initialized
Whether the registration action has fired.
private
bool
$initialized
= false
$instance
Singleton instance.
private
static SettingsSectionRegistry|null
$instance
= null
$sections
Registered sections keyed by parent page id and section id.
private
array<string|int, mixed>
$sections
= array()
Methods
get_instance()
Get the registry instance.
public
static get_instance() : SettingsSectionRegistry
Tags
Return values
SettingsSectionRegistry —get_registered()
Get a registered section.
public
get_registered(string $parent_page_id, string $section_id) : SettingsSectionInterface|null
Parameters
- $parent_page_id : string
-
Parent settings page id.
- $section_id : string
-
Section id.
Tags
Return values
SettingsSectionInterface|null —get_sections_for_page()
Get registered section labels for a settings page.
public
get_sections_for_page(string $parent_page_id) : array<string, string>
Parameters
- $parent_page_id : string
-
Parent settings page id.
Tags
Return values
array<string, string> —register()
Register a settings section.
public
register(SettingsSectionInterface $section) : bool
Parameters
- $section : SettingsSectionInterface
-
Section instance.
Tags
Return values
bool — True when registered.unregister_all()
Clear all registered sections.
public
unregister_all() : void
Tags
Return values
void —initialize()
Fire the section registration action once.
private
initialize() : void
Return values
void —is_reserved_checkout_section_id()
Check whether a checkout section id is reserved by an existing payment gateway.
private
is_reserved_checkout_section_id(string $parent_page_id, string $section_id) : bool
Parameters
- $parent_page_id : string
-
Parent settings page id.
- $section_id : string
-
Section id.
Return values
bool —normalize_id()
Normalize page and section identifiers.
private
normalize_id(string $id) : string
Parameters
- $id : string
-
Identifier.
