Automattic\WooCommerce\Admin\Features\Settings

Transformer::end_checkbox_group()privateWC 1.0

End current checkbox group.

Method of the class: Transformer{}

No Hooks.

Return

null. Nothing (null).

Usage

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

Transformer::end_checkbox_group() code WC 9.7.1

private function end_checkbox_group( array $setting, array &$transformed_settings ): void {
	if ( empty( $this->current_checkbox_group ) ) {
		// If we don't have an open checkbox group, add the setting as-is.
		$this->add_setting( $setting, $transformed_settings );
		return;
	}

	$this->current_checkbox_group[] = $setting;
	$first_setting                  = $this->current_checkbox_group[0];

	$checkbox_group_setting = array(
		'type'     => 'checkboxgroup',
		'title'    => $first_setting['title'] ?? '',
		'settings' => $this->current_checkbox_group,
	);

	$this->add_setting( $checkbox_group_setting, $transformed_settings );
	$this->current_checkbox_group = null;
}