Merge pull request #15815 from woocommerce/fix/15794
Prevent duplicate sections in tax and api endpoints
This commit is contained in:
commit
fbd92c8105
|
@ -53,9 +53,13 @@ class WC_Settings_Rest_API extends WC_Settings_Page {
|
|||
/**
|
||||
* Get settings array.
|
||||
*
|
||||
* @param string $current_section
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings() {
|
||||
public function get_settings( $current_section = '' ) {
|
||||
$settings = array();
|
||||
|
||||
if ( '' === $current_section ) {
|
||||
$settings = apply_filters( 'woocommerce_settings_rest_api', array(
|
||||
array(
|
||||
'title' => __( 'General options', 'woocommerce' ),
|
||||
|
@ -77,8 +81,9 @@ class WC_Settings_Rest_API extends WC_Settings_Page {
|
|||
'id' => 'general_options',
|
||||
),
|
||||
) );
|
||||
}
|
||||
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings );
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -73,10 +73,16 @@ class WC_Settings_Tax extends WC_Settings_Page {
|
|||
/**
|
||||
* Get settings array.
|
||||
*
|
||||
* @param string $current_section
|
||||
* @return array
|
||||
*/
|
||||
public function get_settings() {
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, include( 'views/settings-tax.php' ) );
|
||||
public function get_settings( $current_section = '' ) {
|
||||
$settings = array();
|
||||
|
||||
if ( '' === $current_section ) {
|
||||
$settings = include( 'views/settings-tax.php' );
|
||||
}
|
||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue