GC_Customize_Panel::__construct()
最后更新于:2021-11-27 07:15:27
GC_Customize_Panel::__construct( GC_Customize_Manager$manager, string$id, array$args=array())Constructor.
参数
- $manager
-
(GC_Customize_Manager) (Required) Customizer bootstrap instance.
- $id
-
(string) (Required) A specific ID for the panel.
- $args
-
(array) (Optional) Array of properties for the new Panel object.
-
‘priority’
(int) Priority of the panel, defining the display order of panels and sections. Default 160. -
‘capability’
(string) Capability required for the panel. Defaultedit_theme_options
. -
‘theme_supports’
(string|string[]) Theme features required to support the panel. -
‘title’
(string) Title of the panel to show in UI. -
‘description’
(string) Description to show in the UI. -
‘type’
(string) Type of the panel. -
‘active_callback’
(callable) Active callback.
Default value: array()
-
‘priority’
源文件
文件: gc-includes/class-gc-customize-panel.php
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.
}