Resources_Screen
Abstract base class for managing plugin settings screens.
This abstract class provides a foundation for settings screens in the WordPress admin.
It defines common properties such as the hook suffix, capability, and asset URL,
along with the constant NAME which should be defined in concrete subclasses.
Concrete subclasses should implement their specific logic for rendering the screen
and handling settings.
- Full name:
\BigCommerce\Settings\Screens\Resources_Screen - Parent class:
\BigCommerce\Settings\Screens\Abstract_Screen
Constants
| Constant | Visibility | Type | Value |
|---|---|---|---|
NAME | public | string | ’bigcommerce_resources’ |
Methods
__construct
Abstract_Screen constructor.
public __construct(mixed $configuration_status, mixed $assets_url, mixed $template_dir): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$configuration_status | mixed | A flag indicating if the current stage in the setup process. |
$assets_url | mixed | Path to the plugin assets directory. |
$template_dir | mixed |
get_page_title
Gets the title to render for the page.
protected get_page_title(): stringReturn Value:
The title to render for the page.
get_menu_title
Gets the title to show in the admin menu for the page.
protected get_menu_title(): stringReturn Value:
The title to show in the admin menu for the page.
get_page_header
protected get_page_header(): mixedrender_settings_page
Renders the settings page.
public render_settings_page(): voidshould_register
Indicates if this screen should be registered, given the current state of the WordPress installation.
public should_register(): boolReturn Value:
True if the screen should be registered, false otherwise.
Inherited methods
__construct
Abstract_Screen constructor.
public __construct(int $configuration_status, string $assets_url): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$configuration_status | int | A flag indicating if the current stage in the setup process. |
$assets_url | string | Path to the plugin assets directory. |
get_page_title
Gets the title to render for the page.
protected get_page_title(): string- This method is abstract.
Return Value:
The title to render for the page.
get_menu_title
Gets the title to show in the admin menu for the page.
protected get_menu_title(): string- This method is abstract.
Return Value:
The title to show in the admin menu for the page.
get_header
Retrieves the header HTML for the settings page.
protected get_header(): stringThis method generates the header for the settings page, including the page title wrapped
in an <h1> tag. If the title is empty, it returns an empty string.
The title is obtained by calling the get_page_title() method, and additional content
may be prepended to the title using the before_title() method.
Return Value:
The HTML markup for the header, or an empty string if no title is provided.
before_title
Generates the markup before the page title.
protected before_title(): stringThis method outputs a placeholder to indicate where notices should be placed
within the WordPress admin header. It also fires the bigcommerce/settings/before_title/page={NAME}
action hook, allowing other components to hook into this point and potentially add additional content.
Return Value:
The HTML markup for the section before the title.
get_hook_suffix
Gets the hook suffix for the settings page.
public get_hook_suffix(): stringReturn Value:
The hook suffix for the settings page.
get_url
Gets the URL for the settings page.
public get_url(): stringReturn Value:
The URL for the settings page.
register_settings_page
Registers the settings page in the WordPress admin menu.
public register_settings_page(): voidget_capability
Gets the capability required to view the settings page.
public get_capability(): stringReturn Value:
The capability required to view the settings page.
parent_slug
Retrieves the parent slug for the settings page.
protected parent_slug(): stringThis method generates the parent URL slug for the settings page by formatting the URL
with the post type constant from the Product class.
Return Value:
The formatted parent slug for the settings page.
render_settings_page
Renders the settings page.
public render_settings_page(): voidprogress_bar
Renders the onboarding progress bar for the current screen.
protected progress_bar(): stringReturn Value:
The HTML markup for the progress bar.
start_form
Starts the form for the settings page.
protected start_form(): voidend_form
Ends the form for the settings page.
protected end_form(): voidform_action_url
Gets the URL to which the form will submit.
protected form_action_url(): stringReturn Value:
The form action URL.
settings_fields
Renders the hidden settings fields for the form.
protected settings_fields(): voidsubmit_button
Renders the submit button for the settings form.
protected submit_button(): voidbefore_form
Renders content before the settings form starts.
protected before_form(): voidafter_form
Renders content after the settings form finishes.
protected after_form(): voiddo_settings_sections
Renders the settings sections for the settings page.
protected do_settings_sections(string $page): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$page | string | The settings page. |
section_header
Renders the header for the settings section.
protected section_header(array $section, string $page): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$section | array | The settings section. |
$page | string | The settings page. |
section_body
Renders the body for the settings section.
protected section_body(array $section, string $page): voidParameters:
| Parameter | Type | Description |
|---|---|---|
$section | array | The settings section. |
$page | string | The settings page. |
setup_unregistered_redirect
Sets up a redirect for unregistered screens in the admin menu.
protected setup_unregistered_redirect(): voidThis method ensures that if the current screen is not registered,
a redirection is set up to trigger the bigcommerce/settings/unregistered_screen action.
It is only called if the global plugin_page matches the screen’s NAME constant.
redirect_to_screen
Redirects to the current settings screen.
public redirect_to_screen(): voidshould_register
Indicates if this screen should be registered, given the current state of the WordPress installation.
public should_register(): boolReturn Value:
True if the screen should be registered, false otherwise.
set_admin_body_class
Sets the body class for the admin page.
public set_admin_body_class(string $classes = ''): stringParameters:
| Parameter | Type | Description |
|---|---|---|
$classes | string | The existing body classes. |
Return Value:
The modified body classes.
get_admin_body_class
Gets the class for the admin body.
protected get_admin_body_class(): stringReturn Value:
The admin body class.
Automatically generated on 2025-01-21