WC_Install::create_options()private staticWC 1.0

Default options.

Sets up the default options used on the settings page.

Метод класса: WC_Install{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = WC_Install::create_options();

Код WC_Install::create_options() WC 8.7.0

private static function create_options() {
	// Include settings so that we can run through defaults.
	include_once dirname( __FILE__ ) . '/admin/class-wc-admin-settings.php';

	$settings = WC_Admin_Settings::get_settings_pages();

	foreach ( $settings as $section ) {
		if ( ! is_a( $section, 'WC_Settings_Page' ) || ! method_exists( $section, 'get_settings' ) ) {
			continue;
		}
		$subsections = array_unique( array_merge( array( '' ), array_keys( $section->get_sections() ) ) );

		/**
		 * We are using 'WC_Settings_Page::get_settings' on purpose even thought it's deprecated.
		 * See the method documentation for an explanation.
		 */

		foreach ( $subsections as $subsection ) {
			foreach ( $section->get_settings( $subsection ) as $value ) {
				if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
					$autoload = isset( $value['autoload'] ) ? (bool) $value['autoload'] : true;
					add_option( $value['id'], $value['default'], '', ( $autoload ? 'yes' : 'no' ) );
				}
			}
		}
	}

	// Define other defaults if not in setting screens.
	add_option( 'woocommerce_single_image_width', '600', '', 'yes' );
	add_option( 'woocommerce_thumbnail_image_width', '300', '', 'yes' );
	add_option( 'woocommerce_checkout_highlight_required_fields', 'yes', '', 'yes' );
	add_option( 'woocommerce_demo_store', 'no', '', 'no' );

	if ( self::is_new_install() ) {
		// Define initial tax classes.
		WC_Tax::create_tax_class( __( 'Reduced rate', 'woocommerce' ) );
		WC_Tax::create_tax_class( __( 'Zero rate', 'woocommerce' ) );

		// For new installs, setup and enable Approved Product Download Directories.
		wc_get_container()->get( Download_Directories_Sync::class )->init_feature( false, true );
	}
}