diff --git a/includes/admin/class-wc-call-for-price-settings-general.php b/includes/admin/class-wc-call-for-price-settings-general.php index b6a25b8..122e6f9 100644 --- a/includes/admin/class-wc-call-for-price-settings-general.php +++ b/includes/admin/class-wc-call-for-price-settings-general.php @@ -43,13 +43,20 @@ class Alg_WC_Call_For_Price_Settings_General { */ public function __construct() { - $this->id = ''; - $this->desc = __( 'General', 'woocommerce-call-for-price' ); + $this->id = ''; + add_action( 'init', array( &$this, 'add_cfp_desc_general' ) ); add_filter( 'woocommerce_get_sections_alg_call_for_price', array( $this, 'settings_section' ) ); add_filter( 'woocommerce_get_settings_alg_call_for_price_' . $this->id, array( $this, 'get_settings' ), PHP_INT_MAX ); } + /** + * Add desc to setting page. + */ + public function add_cfp_desc_general() { + $this->desc = __( 'General', 'woocommerce-call-for-price' ); + } + /** * Wettings_section. * diff --git a/includes/admin/class-wc-call-for-price-settings-product-types.php b/includes/admin/class-wc-call-for-price-settings-product-types.php index 408e204..a01c4a7 100644 --- a/includes/admin/class-wc-call-for-price-settings-product-types.php +++ b/includes/admin/class-wc-call-for-price-settings-product-types.php @@ -37,6 +37,14 @@ class Alg_WC_Call_For_Price_Settings_Product_Types { */ public function __construct() { add_filter( 'woocommerce_get_sections_alg_call_for_price', array( $this, 'settings_section' ) ); + add_action( 'init', array( &$this, 'add_cfp_desc_product_types' ) ); + add_action( 'woocommerce_admin_field_alg_wc_call_for_price_textarea', array( $this, 'output_custom_textarea' ) ); + add_filter( 'woocommerce_admin_settings_sanitize_option', array( $this, 'unclean_custom_textarea' ), PHP_INT_MAX, 3 ); + } + /** + * Add desc to setting page. + */ + public function add_cfp_desc_product_types() { $this->product_types = array( 'simple' => __( 'Simple Products', 'woocommerce-call-for-price' ), 'variable' => __( 'Variable Products', 'woocommerce-call-for-price' ), @@ -46,8 +54,6 @@ public function __construct() { foreach ( $this->product_types as $product_type_id => $product_type_desc ) { add_filter( 'woocommerce_get_settings_alg_call_for_price_' . $product_type_id, array( $this, 'get_settings' ), PHP_INT_MAX ); } - add_action( 'woocommerce_admin_field_alg_wc_call_for_price_textarea', array( $this, 'output_custom_textarea' ) ); - add_filter( 'woocommerce_admin_settings_sanitize_option', array( $this, 'unclean_custom_textarea' ), PHP_INT_MAX, 3 ); } /**