WC_Settings_Payment_Gateways::add_body_classespublicWC 1.0

Add body classes.

Method of the class: WC_Settings_Payment_Gateways{}

No Hooks.

Returns

String. The modified body classes.

Usage

$WC_Settings_Payment_Gateways = new WC_Settings_Payment_Gateways();
$WC_Settings_Payment_Gateways->add_body_classes( $classes );
$classes(string) (required)
The existing body classes.

WC_Settings_Payment_Gateways::add_body_classes() code WC 10.3.3

public function add_body_classes( $classes ) {
	global $current_tab, $current_section;

	// Bail if the $classes variable is not a string.
	if ( ! is_string( $classes ) ) {
		return $classes;
	}

	// If we are not on the WooCommerce Payments settings page, return the classes as they are.
	if ( self::TAB_NAME !== $current_tab ) {
		return $classes;
	}

	if ( ! $this->should_render_react_section( $current_section ) ) {
		// Add a class to indicate that the payments settings section page is rendered in legacy mode.
		$classes .= ' woocommerce-settings-payments-section_legacy';
		// Add a class to indicate that the current section is rendered in legacy mode.
		$classes .= ' woocommerce_page_wc-settings-checkout-section-' . esc_attr( $this->standardize_section_name( $current_section ) ) . '_legacy';
	}

	return $classes;
}