GC_Customize_Selective_Refresh::add_partial()
最后更新于:2021-11-27 08:00:04
GC_Customize_Selective_Refresh::add_partial( GC_Customize_Partial|string$id, array$args=array())Adds a partial.
参数
- $id
-
(GC_Customize_Partial|string) (Required) Customize Partial object, or Partial ID.
- $args
-
(array) (Optional) Array of properties for the new Partials object. See GC_Customize_Partial::__construct() for information on accepted arguments.
Default value: array()
响应
(GC_Customize_Partial) The instance of the partial that was added.
源文件
文件: gc-includes/customize/class-gc-customize-selective-refresh.php
public function add_partial( $id, $args = array() ) {
if ( $id instanceof GC_Customize_Partial ) {
$partial = $id;
} else {
$class = 'GC_Customize_Partial';
/** This filter is documented in gc-includes/customize/class-gc-customize-selective-refresh.php */
$args = apply_filters( 'customize_dynamic_partial_args', $args, $id );
/** This filter is documented in gc-includes/customize/class-gc-customize-selective-refresh.php */
$class = apply_filters( 'customize_dynamic_partial_class', $class, $id, $args );
$partial = new $class( $this, $id, $args );
}
$this->partials[ $partial->id ] = $partial;
return $partial;
}