Automattic\WooCommerce\Admin\Features\Settings

Transformer::transform_sections()privateWC 1.0

Transform sections within a tab.

Method of the class: Transformer{}

No Hooks.

Return

Array. Transformed sections.

Usage

// private - for code of main (parent) class only
$result = $this->transform_sections( $sections ): array;
$sections(array) (required)
Sections to transform.

Transformer::transform_sections() code WC 9.7.1

private function transform_sections( array $sections ): array {
	$transformed_sections = array();

	foreach ( $sections as $section_id => $section ) {
		// If the section doesn't have settings, or the settings aren't an array, skip it.
		if ( ! isset( $section['settings'] ) || ! is_array( $section['settings'] ) ) {
			$transformed_sections[ $section_id ] = $section;
			continue;
		}

		$transformed_sections[ $section_id ]             = $section;
		$transformed_sections[ $section_id ]['settings'] = $this->transform_section_settings( $section['settings'] );
	}

	return $transformed_sections;
}