ClassesBigCommerceSettingsScreensWelcome Screen

Welcome_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.

Constants

ConstantVisibilityTypeValue
NAMEpublic’bigcommerce_welcome’

Methods

__construct

Abstract_Screen constructor.

public __construct(mixed $configuration_status, mixed $assets_url, mixed $template_dir): mixed

Parameters:

ParameterTypeDescription
$configuration_statusmixedA flag indicating if the current stage in the setup process.
$assets_urlmixedPath to the plugin assets directory.
$template_dirmixed

get_page_title

Gets the title to render for the page.

protected get_page_title(): string

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

Return Value:

The title to show in the admin menu for the page.


render_settings_page

Renders the settings page.

public render_settings_page(): void

should_register

Indicates if this screen should be registered, given the current state of the WordPress installation.

public should_register(): bool

Return Value:

True if the screen should be registered, false otherwise.


Inherited methods

__construct

Abstract_Screen constructor.

public __construct(int $configuration_status, string $assets_url): mixed

Parameters:

ParameterTypeDescription
$configuration_statusintA flag indicating if the current stage in the setup process.
$assets_urlstringPath 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(): string

This 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(): string

This 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(): string

Return Value:

The hook suffix for the settings page.


get_url

Gets the URL for the settings page.

public get_url(): string

Return Value:

The URL for the settings page.


register_settings_page

Registers the settings page in the WordPress admin menu.

public register_settings_page(): void

get_capability

Gets the capability required to view the settings page.

public get_capability(): string

Return Value:

The capability required to view the settings page.


parent_slug

Retrieves the parent slug for the settings page.

protected parent_slug(): string

This 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(): void

progress_bar

Renders the onboarding progress bar for the current screen.

protected progress_bar(): string

Return Value:

The HTML markup for the progress bar.


start_form

Starts the form for the settings page.

protected start_form(): void

end_form

Ends the form for the settings page.

protected end_form(): void

form_action_url

Gets the URL to which the form will submit.

protected form_action_url(): string

Return Value:

The form action URL.


settings_fields

Renders the hidden settings fields for the form.

protected settings_fields(): void

submit_button

Renders the submit button for the settings form.

protected submit_button(): void

before_form

Renders content before the settings form starts.

protected before_form(): void

after_form

Renders content after the settings form finishes.

protected after_form(): void

do_settings_sections

Renders the settings sections for the settings page.

protected do_settings_sections(string $page): void

Parameters:

ParameterTypeDescription
$pagestringThe settings page.

section_header

Renders the header for the settings section.

protected section_header(array $section, string $page): void

Parameters:

ParameterTypeDescription
$sectionarrayThe settings section.
$pagestringThe settings page.

section_body

Renders the body for the settings section.

protected section_body(array $section, string $page): void

Parameters:

ParameterTypeDescription
$sectionarrayThe settings section.
$pagestringThe settings page.

setup_unregistered_redirect

Sets up a redirect for unregistered screens in the admin menu.

protected setup_unregistered_redirect(): void

This 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(): void

should_register

Indicates if this screen should be registered, given the current state of the WordPress installation.

public should_register(): bool

Return 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 = &#039;&#039;): string

Parameters:

ParameterTypeDescription
$classesstringThe 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(): string

Return Value:

The admin body class.


onboarding_page_header

protected onboarding_page_header(): mixed

onboarding_submit_button

protected onboarding_submit_button(mixed $data_attr_name, mixed $classes, mixed $button_label, mixed $hide_label = false): mixed

Parameters:

ParameterTypeDescription
$data_attr_namemixed
$classesmixed
$button_labelmixed
$hide_labelmixed

make_video_embed

protected make_video_embed(mixed $url, mixed $width = 1280, mixed $height = 720): mixed

Parameters:

ParameterTypeDescription
$urlmixed
$widthmixed
$heightmixed


Automatically generated on 2025-01-21