WP_Customize_Panel::__construct()publicWP 4.0.0

Constructor.

Any supplied $args override class property defaults.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$WP_Customize_Panel = new WP_Customize_Panel();
$WP_Customize_Panel->__construct( $manager, $id, $args );
$manager(WP_Customize_Manager) (обязательный)
Customizer bootstrap instance.
$id(строка) (обязательный)
A specific ID for the panel.
$args(массив)

Array of properties for the new Panel object.

По умолчанию: empty array

  • priority(int)
    Priority of the panel, defining the display order of panels and sections.
    По умолчанию: 160

  • capability(строка)
    Capability required for the panel.
    По умолчанию: edit_theme_options

  • theme_supports(mixed[])
    Theme features required to support the panel.

  • title(строка)
    Title of the panel to show in UI.

  • description(строка)
    Description to show in the UI.

  • type(строка)
    Type of the panel.

  • active_callback(callable)
    Active callback.

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

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

Код WP_Customize_Panel::__construct() WP 6.4.3

public function __construct( $manager, $id, $args = array() ) {
	$keys = array_keys( get_object_vars( $this ) );
	foreach ( $keys as $key ) {
		if ( isset( $args[ $key ] ) ) {
			$this->$key = $args[ $key ];
		}
	}

	$this->manager = $manager;
	$this->id      = $id;
	if ( empty( $this->active_callback ) ) {
		$this->active_callback = array( $this, 'active_callback' );
	}
	self::$instance_count += 1;
	$this->instance_number = self::$instance_count;

	$this->sections = array(); // Users cannot customize the $sections array.
}