Merge pull request #15815 from woocommerce/fix/15794

Prevent duplicate sections in tax and api endpoints
This commit is contained in:
Claudio Sanches 2017-06-27 13:01:05 -03:00 committed by GitHub
commit fbd92c8105
2 changed files with 34 additions and 23 deletions

View File

@ -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 );
}
/**

View File

@ -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 );
}
/**