WC_Register_WP_Admin_Settings::__construct()
Hooks into the settings API and starts registering our settings.
Method of the class: WC_Register_WP_Admin_Settings{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WC_Register_WP_Admin_Settings = new WC_Register_WP_Admin_Settings(); $WC_Register_WP_Admin_Settings->__construct( $object, $type );
- $object(WC_Email|WC_Settings_Page) (required)
- The object that contains the settings to register.
- $type(string) (required)
- Type of settings to register (email or page).
Changelog
Since 3.0.0 | Introduced. |
WC_Register_WP_Admin_Settings::__construct() WC Register WP Admin Settings:: construct code WC 9.4.2
public function __construct( $object, $type ) { if ( ! is_object( $object ) ) { return; } $this->object = $object; if ( 'page' === $type ) { add_filter( 'woocommerce_settings_groups', array( $this, 'register_page_group' ) ); add_filter( 'woocommerce_settings-' . $this->object->get_id(), array( $this, 'register_page_settings' ) ); } elseif ( 'email' === $type ) { add_filter( 'woocommerce_settings_groups', array( $this, 'register_email_group' ) ); add_filter( 'woocommerce_settings-email_' . $this->object->id, array( $this, 'register_email_settings' ) ); } }