WC_Settings_Payment_Gateways_React
extends WC_Settings_Page
in package
WC_Settings_Payment_Gateways_React.
Table of Contents
- MAIN_SECTION_NAME = 'main'
- OFFLINE_SECTION_NAME = 'offline'
- TAB_NAME = 'checkout'
- TYPE_CHECKBOX = 'checkbox'
- TYPE_COLOR = 'color'
- TYPE_DATE = 'date'
- TYPE_DATETIME = 'datetime'
- TYPE_DATETIME_LOCAL = 'datetime-local'
- TYPE_EMAIL = 'email'
- TYPE_IMAGE_WIDTH = 'image_width'
- TYPE_INFO = 'info'
- TYPE_MONTH = 'month'
- TYPE_MULTI_SELECT_COUNTRIES = 'multi_select_countries'
- TYPE_MULTISELECT = 'multiselect'
- TYPE_NUMBER = 'number'
- TYPE_PASSWORD = 'password'
- TYPE_RADIO = 'radio'
- TYPE_RELATIVE_DATE_SELECTOR = 'relative_date_selector'
- TYPE_SECTIONEND = 'sectionend'
- TYPE_SELECT = 'select'
- TYPE_SINGLE_SELECT_COUNTRY = 'single_select_country'
- TYPE_SINGLE_SELECT_PAGE = 'single_select_page'
- TYPE_SINGLE_SELECT_PAGE_WITH_SEARCH = 'single_select_page_with_search'
- TYPE_SLOTFILL_PLACEHOLDER = 'slotfill_placeholder'
- TYPE_TEL = 'tel'
- TYPE_TEXT = 'text'
- TYPE_TEXTAREA = 'textarea'
- TYPE_TIME = 'time'
- TYPE_TITLE = 'title'
- Setting field types.
- TYPE_URL = 'url'
- TYPE_WEEK = 'week'
- $icon : string
- Setting page icon.
- $id : string
- Setting page id.
- $is_modern : bool
- Setting page is modern.
- $label : string
- Setting page label.
- $types : array<string|int, string>
- Settings field types which are known.
- $output_called : bool
- Whether the output method has been called.
- __construct() : mixed
- Constructor.
- add_settings_page() : mixed
- Add this page to settings.
- add_settings_page_data() : array<string|int, mixed>
- Get page settings data to populate the settings editor.
- add_settings_slot() : mixed
- Creates the React mount point for settings slot.
- get_custom_type_field() : array<string|int, mixed>
- Get the custom type field by calling the action and returning the setting with the content, id, and type.
- get_custom_view() : string
- Get the custom view given the current tab and section.
- get_id() : string
- Get settings page ID.
- get_label() : string
- Get settings page label.
- get_sections() : array<string|int, mixed>
- Get all sections for the current page.
- get_settings() : array<string|int, mixed>
- Get settings array for the default section.
- get_settings_for_section() : array<string|int, mixed>
- Get settings array.
- hide_help_tabs() : mixed
- Hide the help tabs.
- output() : mixed
- Output the settings.
- output_sections() : mixed
- Output sections.
- save() : mixed
- Save settings.
- suppress_admin_notices() : mixed
- Suppress WP admin notices on the WooCommerce Payments settings page.
- suppress_store_alerts() : mixed
- Suppress the store-alerts WCAdmin feature on the WooCommerce Payments settings page and Reactified sections.
- do_update_options_action() : mixed
- Trigger the 'woocommerce_update_options_'.id action.
- get_own_sections() : array<string|int, mixed>
- Get own sections for this page.
- get_section_settings_data() : array<string|int, mixed>
- Get settings data for a specific section.
- get_settings_for_default_section() : array<string|int, mixed>
- Get settings array.
- get_settings_for_section_core() : array<string|int, mixed>
- Get the settings for a given section.
- populate_setting_value() : array<string|int, mixed>
- Populate the value for a given section setting.
- run_gateway_admin_options() : mixed
- Run the 'admin_options' method on a given gateway.
- save_settings_for_current_section() : mixed
- Save settings for current section.
- get_reactify_render_sections() : array<string|int, mixed>
- Get the whitelist of sections to render using React.
- render_classic_gateway_settings_page() : mixed
- Render the classic gateway settings page.
- render_react_section() : mixed
- Render the React section.
- should_render_react_section() : bool
- Check if the given section should be rendered using React.
- standardize_section_name() : string
- Standardize the current section name.
Constants
MAIN_SECTION_NAME
public
mixed
MAIN_SECTION_NAME
= 'main'
OFFLINE_SECTION_NAME
public
mixed
OFFLINE_SECTION_NAME
= 'offline'
TAB_NAME
public
mixed
TAB_NAME
= 'checkout'
TYPE_CHECKBOX
public
mixed
TYPE_CHECKBOX
= 'checkbox'
TYPE_COLOR
public
mixed
TYPE_COLOR
= 'color'
TYPE_DATE
public
mixed
TYPE_DATE
= 'date'
TYPE_DATETIME
public
mixed
TYPE_DATETIME
= 'datetime'
TYPE_DATETIME_LOCAL
public
mixed
TYPE_DATETIME_LOCAL
= 'datetime-local'
TYPE_EMAIL
public
mixed
TYPE_EMAIL
= 'email'
TYPE_IMAGE_WIDTH
public
mixed
TYPE_IMAGE_WIDTH
= 'image_width'
TYPE_INFO
public
mixed
TYPE_INFO
= 'info'
TYPE_MONTH
public
mixed
TYPE_MONTH
= 'month'
TYPE_MULTI_SELECT_COUNTRIES
public
mixed
TYPE_MULTI_SELECT_COUNTRIES
= 'multi_select_countries'
TYPE_MULTISELECT
public
mixed
TYPE_MULTISELECT
= 'multiselect'
TYPE_NUMBER
public
mixed
TYPE_NUMBER
= 'number'
TYPE_PASSWORD
public
mixed
TYPE_PASSWORD
= 'password'
TYPE_RADIO
public
mixed
TYPE_RADIO
= 'radio'
TYPE_RELATIVE_DATE_SELECTOR
public
mixed
TYPE_RELATIVE_DATE_SELECTOR
= 'relative_date_selector'
TYPE_SECTIONEND
public
mixed
TYPE_SECTIONEND
= 'sectionend'
TYPE_SELECT
public
mixed
TYPE_SELECT
= 'select'
TYPE_SINGLE_SELECT_COUNTRY
public
mixed
TYPE_SINGLE_SELECT_COUNTRY
= 'single_select_country'
TYPE_SINGLE_SELECT_PAGE
public
mixed
TYPE_SINGLE_SELECT_PAGE
= 'single_select_page'
TYPE_SINGLE_SELECT_PAGE_WITH_SEARCH
public
mixed
TYPE_SINGLE_SELECT_PAGE_WITH_SEARCH
= 'single_select_page_with_search'
TYPE_SLOTFILL_PLACEHOLDER
public
mixed
TYPE_SLOTFILL_PLACEHOLDER
= 'slotfill_placeholder'
TYPE_TEL
public
mixed
TYPE_TEL
= 'tel'
TYPE_TEXT
public
mixed
TYPE_TEXT
= 'text'
TYPE_TEXTAREA
public
mixed
TYPE_TEXTAREA
= 'textarea'
TYPE_TIME
public
mixed
TYPE_TIME
= 'time'
TYPE_TITLE
Setting field types.
public
string
TYPE_TITLE
= 'title'
TYPE_URL
public
mixed
TYPE_URL
= 'url'
TYPE_WEEK
public
mixed
TYPE_WEEK
= 'week'
Properties
$icon
Setting page icon.
public
string
$icon
= 'payment'
$id
Setting page id.
protected
string
$id
= ''
$is_modern
Setting page is modern.
protected
bool
$is_modern
= alse
$label
Setting page label.
protected
string
$label
= ''
$types
Settings field types which are known.
protected
array<string|int, string>
$types
= array(self::TYPE_TITLE, self::TYPE_INFO, self::TYPE_SECTIONEND, self::TYPE_TEXT, self::TYPE_PASSWORD, self::TYPE_DATETIME, self::TYPE_DATETIME_LOCAL, self::TYPE_DATE, self::TYPE_MONTH, self::TYPE_TIME, self::TYPE_WEEK, self::TYPE_NUMBER, self::TYPE_EMAIL, self::TYPE_URL, self::TYPE_TEL, self::TYPE_COLOR, self::TYPE_TEXTAREA, self::TYPE_SELECT, self::TYPE_MULTISELECT, self::TYPE_RADIO, self::TYPE_CHECKBOX, self::TYPE_IMAGE_WIDTH, self::TYPE_SINGLE_SELECT_PAGE, self::TYPE_SINGLE_SELECT_PAGE_WITH_SEARCH, self::TYPE_SINGLE_SELECT_COUNTRY, self::TYPE_MULTI_SELECT_COUNTRIES, self::TYPE_RELATIVE_DATE_SELECTOR, self::TYPE_SLOTFILL_PLACEHOLDER)
$output_called
Whether the output method has been called.
private
bool
$output_called
= alse
Methods
__construct()
Constructor.
public
__construct() : mixed
Return values
mixed —add_settings_page()
Add this page to settings.
public
add_settings_page(array<string|int, mixed> $pages) : mixed
Parameters
- $pages : array<string|int, mixed>
-
The settings array where we'll add ourselves.
Return values
mixed —add_settings_page_data()
Get page settings data to populate the settings editor.
public
add_settings_page_data(array<string|int, mixed> $pages) : array<string|int, mixed>
Parameters
- $pages : array<string|int, mixed>
-
The settings array where we'll add data.
Return values
array<string|int, mixed> —add_settings_slot()
Creates the React mount point for settings slot.
public
add_settings_slot() : mixed
Return values
mixed —get_custom_type_field()
Get the custom type field by calling the action and returning the setting with the content, id, and type.
public
get_custom_type_field(string $action, array<string|int, mixed> $setting) : array<string|int, mixed>
Parameters
- $action : string
-
The action to call.
- $setting : array<string|int, mixed>
-
The setting to pass to the action.
Return values
array<string|int, mixed> — The setting with the content, id, and type.get_custom_view()
Get the custom view given the current tab and section.
public
get_custom_view(string $action[, string $section_id = false ]) : string
Parameters
- $action : string
-
The action to call.
- $section_id : string = false
-
The section id.
Return values
string — The custom view. HTML output.get_id()
Get settings page ID.
public
get_id() : string
Tags
Return values
string —get_label()
Get settings page label.
public
get_label() : string
Tags
Return values
string —get_sections()
Get all sections for the current page.
public
get_sections() : array<string|int, mixed>
Reactified section pages won't have any sections.
The rest of the settings pages will get the default/own section and those added via
the woocommerce_get_sections_checkout
filter.
Return values
array<string|int, mixed> — The sections for this settings page.get_settings()
Get settings array for the default section.
public
get_settings() : array<string|int, mixed>
External settings classes (registered via 'woocommerce_get_settings_pages' filter) might have redefined this method as "get_settings($section_id='')", thus we need to use this method internally instead of 'get_settings_for_section' to register settings and render settings pages.
But we can't just redefine the method as "get_settings($section_id='')" here, since this will break on PHP 8 if any external setting class have it as 'get_settings()'.
Thus we leave the method signature as is and use 'func_get_arg' to get the setting id if it's supplied, and we use this method internally; but it's deprecated and should otherwise never be used.
Tags
Return values
array<string|int, mixed> — Settings array, each item being an associative array representing a setting.get_settings_for_section()
Get settings array.
public
final get_settings_for_section(string $section_id) : array<string|int, mixed>
The strategy for getting the settings is as follows:
-
If a method named 'get_settings_for_{section_id}_section' exists in the class it will be invoked (for the default '' section, the method name is 'get_settings_for_default_section'). Derived classes can implement these methods as required.
-
Otherwise, 'get_settings_for_section_core' will be invoked. Derived classes can override it as an alternative to implementing 'get_settings_for_{section_id}_section' methods.
Parameters
- $section_id : string
-
The id of the section to return settings for, an empty string for the default section.
Return values
array<string|int, mixed> — Settings array, each item being an associative array representing a setting.hide_help_tabs()
Hide the help tabs.
public
hide_help_tabs() : mixed
Return values
mixed —output()
Output the settings.
public
output() : mixed
Return values
mixed —output_sections()
Output sections.
public
output_sections() : mixed
Return values
mixed —save()
Save settings.
public
save() : mixed
Return values
mixed —suppress_admin_notices()
Suppress WP admin notices on the WooCommerce Payments settings page.
public
suppress_admin_notices() : mixed
Return values
mixed —suppress_store_alerts()
Suppress the store-alerts WCAdmin feature on the WooCommerce Payments settings page and Reactified sections.
public
suppress_store_alerts(mixed $features) : mixed
Parameters
- $features : mixed
-
The WCAdmin features list.
Return values
mixed — The modified features list.do_update_options_action()
Trigger the 'woocommerce_update_options_'.id action.
protected
do_update_options_action([string $section_id = null ]) : mixed
Parameters
- $section_id : string = null
-
Section to trigger the action for, or null for current section.
Return values
mixed —get_own_sections()
Get own sections for this page.
protected
get_own_sections() : array<string|int, mixed>
Derived classes should override this method if they define sections. There should always be one default section with an empty string as identifier.
Example: return array( '' => __( 'General', 'woocommerce' ), 'foobars' => __( 'Foos & Bars', 'woocommerce' ), );
Return values
array<string|int, mixed> — An associative array where keys are section identifiers and the values are translated section names.get_section_settings_data()
Get settings data for a specific section.
protected
get_section_settings_data(string $section_id, array<string|int, mixed> $sections) : array<string|int, mixed>
Parameters
- $section_id : string
-
The ID of the section.
- $sections : array<string|int, mixed>
-
All sections available.
Return values
array<string|int, mixed> — Settings data for the section.get_settings_for_default_section()
Get settings array.
protected
get_settings_for_default_section() : array<string|int, mixed>
This is just for backward compatibility with the rest of the codebase (primarily API responses).
Return values
array<string|int, mixed> —get_settings_for_section_core()
Get the settings for a given section.
protected
get_settings_for_section_core(string $section_id) : array<string|int, mixed>
This method is invoked from 'get_settings_for_section' when no 'get_settings_for_{current_section}_section' method exists in the class.
When overriding, note that the 'woocommerce_get_settings_' filter must NOT be triggered, as this is already done by 'get_settings_for_section'.
Parameters
- $section_id : string
-
The section name to get the settings for.
Return values
array<string|int, mixed> — Settings array, each item being an associative array representing a setting.populate_setting_value()
Populate the value for a given section setting.
protected
populate_setting_value(array<string|int, mixed> $section_setting) : array<string|int, mixed>
Parameters
- $section_setting : array<string|int, mixed>
-
The setting array to populate.
Return values
array<string|int, mixed> — The setting array with populated value.run_gateway_admin_options()
Run the 'admin_options' method on a given gateway.
protected
run_gateway_admin_options(object $gateway) : mixed
This method exists to help with unit testing.
Parameters
- $gateway : object
-
The gateway object to run the method on.
Return values
mixed —save_settings_for_current_section()
Save settings for current section.
protected
save_settings_for_current_section() : mixed
Return values
mixed —get_reactify_render_sections()
Get the whitelist of sections to render using React.
private
get_reactify_render_sections() : array<string|int, mixed>
Return values
array<string|int, mixed> — List of section identifiers.render_classic_gateway_settings_page()
Render the classic gateway settings page.
private
render_classic_gateway_settings_page(array<string|int, mixed> $payment_gateways, string $current_section) : mixed
Parameters
- $payment_gateways : array<string|int, mixed>
-
The payment gateways.
- $current_section : string
-
The current section.
Return values
mixed —render_react_section()
Render the React section.
private
render_react_section(string $section) : mixed
Parameters
- $section : string
-
The section to render.
Return values
mixed —should_render_react_section()
Check if the given section should be rendered using React.
private
should_render_react_section(string $section) : bool
Parameters
- $section : string
-
The section to check.
Return values
bool — Whether the section should be rendered using React.standardize_section_name()
Standardize the current section name.
private
standardize_section_name(string $section) : string
Parameters
- $section : string
-
The section name to standardize.