WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru WPmentor - Ищем топовых специалистов по WordPress, чтобы помочь вам заработать
функция не описана

WP_Customize_Manager::prepare_controls() WP 3.4.0

Prepare panels, sections, and controls.

For each, check if required related components exist, whether the user has the necessary capabilities, and sort by priority.

Это метод класса: WP_Customize_Manager

Хуков нет.

Возвращает

Null. Ничего.

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

$WP_Customize_Manager = new WP_Customize_Manager();
$var = $WP_Customize_Manager->prepare_controls();

Список изменений

С версии 3.4.0 Введена.

Код WP Customize Manager::prepare controls: wp-includes/class-wp-customize-manager.php WP 5.4

<?php
public function prepare_controls() {

	$controls       = array();
	$this->controls = wp_list_sort(
		$this->controls,
		array(
			'priority'        => 'ASC',
			'instance_number' => 'ASC',
		),
		'ASC',
		true
	);

	foreach ( $this->controls as $id => $control ) {
		if ( ! isset( $this->sections[ $control->section ] ) || ! $control->check_capabilities() ) {
			continue;
		}

		$this->sections[ $control->section ]->controls[] = $control;
		$controls[ $id ]                                 = $control;
	}
	$this->controls = $controls;

	// Prepare sections.
	$this->sections = wp_list_sort(
		$this->sections,
		array(
			'priority'        => 'ASC',
			'instance_number' => 'ASC',
		),
		'ASC',
		true
	);
	$sections       = array();

	foreach ( $this->sections as $section ) {
		if ( ! $section->check_capabilities() ) {
			continue;
		}

		$section->controls = wp_list_sort(
			$section->controls,
			array(
				'priority'        => 'ASC',
				'instance_number' => 'ASC',
			)
		);

		if ( ! $section->panel ) {
			// Top-level section.
			$sections[ $section->id ] = $section;
		} else {
			// This section belongs to a panel.
			if ( isset( $this->panels [ $section->panel ] ) ) {
				$this->panels[ $section->panel ]->sections[ $section->id ] = $section;
			}
		}
	}
	$this->sections = $sections;

	// Prepare panels.
	$this->panels = wp_list_sort(
		$this->panels,
		array(
			'priority'        => 'ASC',
			'instance_number' => 'ASC',
		),
		'ASC',
		true
	);
	$panels       = array();

	foreach ( $this->panels as $panel ) {
		if ( ! $panel->check_capabilities() ) {
			continue;
		}

		$panel->sections      = wp_list_sort(
			$panel->sections,
			array(
				'priority'        => 'ASC',
				'instance_number' => 'ASC',
			),
			'ASC',
			true
		);
		$panels[ $panel->id ] = $panel;
	}
	$this->panels = $panels;

	// Sort panels and top-level sections together.
	$this->containers = array_merge( $this->panels, $this->sections );
	$this->containers = wp_list_sort(
		$this->containers,
		array(
			'priority'        => 'ASC',
			'instance_number' => 'ASC',
		),
		'ASC',
		true
	);
}