WC_Settings_Payment_Gateways::get_reactified_sections
Get the whitelist of sections to render using React.
Method of the class: WC_Settings_Payment_Gateways{}
Hooks from the method
Returns
Array. List of section identifiers.
Usage
// private - for code of main (parent) class only $result = $this->get_reactified_sections(): array;
WC_Settings_Payment_Gateways::get_reactified_sections() WC Settings Payment Gateways::get reactified sections code WC 10.3.3
private function get_reactified_sections(): array {
if ( ! is_null( $this->reactified_sections_memo ) ) {
return $this->reactified_sections_memo;
}
// These sections are always rendered using React.
$reactified_sections = array(
self::MAIN_SECTION_NAME,
self::OFFLINE_SECTION_NAME,
);
// These sections are optional and can be modified by plugins or themes.
$optional_reactified_sections = array(
self::COD_SECTION_NAME,
self::BACS_SECTION_NAME,
self::CHEQUE_SECTION_NAME,
);
/**
* Modify the optional set of payments settings sections to be rendered using React.
*
* This filter allows plugins to add or remove optional sections (typically offline gateways)
* that should be rendered using React. Sections should be identified by their gateway IDs.
* Note: The main Payments page ("main") and the Offline overview ("offline") are always React-only
* and cannot be disabled via this filter.
*
* @since 9.3.0
*
* @param array $sections List of section identifiers to be rendered using React.
*/
$optional_reactified_sections = apply_filters( 'experimental_woocommerce_admin_payment_reactify_render_sections', $optional_reactified_sections );
if ( empty( $optional_reactified_sections ) || ! is_array( $optional_reactified_sections ) ) {
// Sanity check: use empty array if the filter returns something unexpected.
$optional_reactified_sections = array();
} else {
// Enforce a list format and string-only values for section identifiers.
$optional_reactified_sections = array_values( array_filter( $optional_reactified_sections, 'is_string' ) );
}
$this->reactified_sections_memo = array_unique( array_merge( $reactified_sections, $optional_reactified_sections ) );
return $this->reactified_sections_memo;
}