Automattic\WooCommerce\Admin\Features\Settings

Transformer::process_settingprivateWC 1.0

Process individual setting.

Method of the class: Transformer{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->process_setting( ?array $setting, $transformed_settings ): void;
?array $setting(required)
.
$transformed_settings(array) (required)
Transformed settings array.

Transformer::process_setting() code WC 10.3.6

private function process_setting( ?array $setting, array &$transformed_settings ): void {
	if ( ! isset( $setting ) ) {
		return;
	}

	$type = $setting['type'] ?? '';

	if ( $this->current_checkbox_group && 'checkbox' !== $type ) {
		// It's expected that a checkbox group will always be closed before a non-checkbox setting.
		// If not, it's likely a checkbox group was not closed properly so we flush the current checkbox group and add the setting as-is.
		$this->flush_current_checkbox_group();
	}

	switch ( $type ) {
		case 'title':
			$this->handle_group_start( $setting, $transformed_settings );
			break;

		case 'sectionend':
			$this->handle_group_end( $setting, $transformed_settings );
			break;

		case 'checkbox':
			$this->handle_checkbox_setting( $setting, $transformed_settings );
			break;

		case 'info':
			if ( ! empty( $setting['text'] ) ) {
				$setting['text'] = wp_kses_post( wpautop( wptexturize( $setting['text'] ) ) );
			}
			if ( ! empty( $setting['row_class'] ) && substr( $setting['row_class'], 0, 16 ) !== 'wc-settings-row-' ) {
				$setting['row_class'] = 'wc-settings-row-' . $setting['row_class'];
			}

			$this->add_setting( $setting, $transformed_settings );
			break;

		default:
			$this->add_setting( $setting, $transformed_settings );
			break;
	}
}