Automattic\WooCommerce\Internal\Admin\Settings
SettingsUIRequestContext::get_current_settings_section
Get the current WooCommerce settings section.
Reads $_REQUEST to match how the legacy $current_section global is derived, so context resolution and legacy settings rendering agree on the section.
Method of the class: SettingsUIRequestContext{}
No Hooks.
Returns
string.
Usage
$result = SettingsUIRequestContext::get_current_settings_section(): string;
SettingsUIRequestContext::get_current_settings_section() SettingsUIRequestContext::get current settings section code WC 11.1.2
private static function get_current_settings_section(): string {
// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
if ( ! isset( $_REQUEST['section'] ) ) {
return '';
}
$section = wp_unslash( $_REQUEST['section'] );
// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
return is_string( $section ) ? sanitize_title( $section ) : '';
}