Automattic\WooCommerce\Admin\Features\Settings

Transformer::transform_sections()privateWC 1.0

Transform sections within a tab.

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

Хуков нет.

Возвращает

Массив. Transformed sections.

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

// private - только в коде основоного (родительского) класса
$result = $this->transform_sections( $sections ): array;
$sections(массив) (обязательный)
Sections to transform.

Код Transformer::transform_sections() 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;
}