Automattic\WooCommerce\Internal\Admin\Settings
PaymentsController::handle_sections
Alter the Payments tab sections under certain conditions.
Method of the class: PaymentsController{}
No Hooks.
Returns
Array. The filtered sections.
Usage
$PaymentsController = new PaymentsController(); $PaymentsController->handle_sections( $sections ): array;
- $sections(array)
- The payments/checkout tab sections.
Default:array()
PaymentsController::handle_sections() PaymentsController::handle sections code WC 10.5.0
public function handle_sections( $sections = array() ): array {
global $current_section;
// Reset the value if the type is invalid.
if ( ! is_array( $sections ) ) {
$sections = array();
}
// Bail if the current section global is empty or of the wrong type.
if ( empty( $current_section ) || ! is_string( $current_section ) ) {
return $sections;
}
// For WooPayments and offline payment methods settings pages, we don't want any section navigation.
if ( in_array( $current_section, array( WooPaymentsService::GATEWAY_ID, WC_Gateway_BACS::ID, WC_Gateway_Cheque::ID, WC_Gateway_COD::ID ), true ) ) {
return array();
}
return $sections;
}