Merge pull request #14784 from woocommerce/fix/14769

get_settings for shipping and checkout need to support sections for the API
This commit is contained in:
Claudio Sanches 2017-04-28 12:49:53 -03:00 committed by GitHub
commit c48ddfbab8
2 changed files with 214 additions and 206 deletions

View File

@ -61,7 +61,10 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
*
* @return array
*/
public function get_settings() {
public function get_settings( $current_section = '' ) {
$settings = array();
if ( '' === $current_section ) {
$settings = apply_filters( 'woocommerce_payment_gateways_settings', array(
array(
@ -244,8 +247,9 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
if ( wc_site_is_https() ) {
unset( $settings['unforce_ssl_checkout'] );
}
}
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings );
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section );
}
/**

View File

@ -71,7 +71,10 @@ class WC_Settings_Shipping extends WC_Settings_Page {
*
* @return array
*/
public function get_settings() {
public function get_settings( $current_section = '' ) {
$settings = array();
if ( '' === $current_section ) {
$settings = apply_filters( 'woocommerce_shipping_settings', array(
array( 'title' => __( 'Shipping options', 'woocommerce' ), 'type' => 'title', 'id' => 'shipping_options' ),
@ -124,8 +127,9 @@ class WC_Settings_Shipping extends WC_Settings_Page {
array( 'type' => 'sectionend', 'id' => 'shipping_options' ),
) );
}
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings );
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section );
}
/**