Automattic\WooCommerce\Admin\Settings

SettingsSectionRegistry::initializeprivateWC 1.0

Fire the section registration action once.

Method of the class: SettingsSectionRegistry{}

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->initialize(): void;

SettingsSectionRegistry::initialize() code WC 10.9.1

private function initialize(): void {
	if ( $this->initialized ) {
		return;
	}

	// Mark initialized before firing the action so re-entrant registry lookups do not run it again.
	$this->initialized = true;

	try {
		/**
		 * Fires when settings sections can be registered.
		 *
		 * @param SettingsSectionRegistry $registry Settings section registry.
		 *
		 * @since 10.9.0
		 */
		do_action( 'woocommerce_settings_sections_registration', $this );
	} catch ( \Throwable $e ) {
		wc_get_logger()->error(
			sprintf(
				'Settings section registration failed: %1$s: %2$s',
				get_class( $e ),
				$e->getMessage()
			),
			array( 'source' => 'settings-ui' )
		);

		if ( $e instanceof \Exception ) {
			wc_caught_exception( $e, __CLASS__ . '::' . __FUNCTION__ );
		}
	}
}