Automattic\WooCommerce\Internal\Admin\Logging

Settings::get_settings_definitions()privateWC 1.0

The definitions used by WC_Admin_Settings to render and save settings controls.

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

Хуков нет.

Возвращает

Массив.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_settings_definitions(): array;

Код Settings::get_settings_definitions() WC 9.4.2

private function get_settings_definitions(): array {
	$settings = array(
		'start'                 => array(
			'title' => __( 'Logs settings', 'woocommerce' ),
			'id'    => self::PREFIX . 'settings',
			'type'  => 'title',
		),
		'logging_enabled'       => array(
			'title'    => __( 'Logger', 'woocommerce' ),
			'desc'     => __( 'Enable logging', 'woocommerce' ),
			'id'       => self::PREFIX . 'logging_enabled',
			'type'     => 'checkbox',
			'value'    => $this->logging_is_enabled() ? 'yes' : 'no',
			'default'  => self::DEFAULTS['logging_enabled'] ? 'yes' : 'no',
			'autoload' => false,
		),
		'default_handler'       => array(),
		'retention_period_days' => array(),
		'level_threshold'       => array(),
		'end'                   => array(
			'id'   => self::PREFIX . 'settings',
			'type' => 'sectionend',
		),
	);

	if ( true === $this->logging_is_enabled() ) {
		$settings['default_handler']       = $this->get_default_handler_setting_definition();
		$settings['retention_period_days'] = $this->get_retention_period_days_setting_definition();
		$settings['level_threshold']       = $this->get_level_threshold_setting_definition();

		$default_handler = $this->get_default_handler();
		if ( in_array( $default_handler, array( LogHandlerFileV2::class, WC_Log_Handler_File::class ), true ) ) {
			$settings += $this->get_filesystem_settings_definitions();
		} elseif ( WC_Log_Handler_DB::class === $default_handler ) {
			$settings += $this->get_database_settings_definitions();
		}
	}

	return $settings;
}