wp/wp-includes/customize/class-wp-customize-partial.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 21 48c4eec2b7e6
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    66 
    66 
    67 	/**
    67 	/**
    68 	 * IDs for settings tied to the partial.
    68 	 * IDs for settings tied to the partial.
    69 	 *
    69 	 *
    70 	 * @since 4.5.0
    70 	 * @since 4.5.0
    71 	 * @var array
    71 	 * @var string[]
    72 	 */
    72 	 */
    73 	public $settings;
    73 	public $settings;
    74 
    74 
    75 	/**
    75 	/**
    76 	 * The ID for the setting that this partial is primarily responsible for rendering.
    76 	 * The ID for the setting that this partial is primarily responsible for rendering.
    95 
    95 
    96 	/**
    96 	/**
    97 	 * Render callback.
    97 	 * Render callback.
    98 	 *
    98 	 *
    99 	 * @since 4.5.0
    99 	 * @since 4.5.0
       
   100 	 *
   100 	 * @see WP_Customize_Partial::render()
   101 	 * @see WP_Customize_Partial::render()
   101 	 * @var callable Callback is called with one argument, the instance of
   102 	 * @var callable Callback is called with one argument, the instance of
   102 	 *                 WP_Customize_Partial. The callback can either echo the
   103 	 *               WP_Customize_Partial. The callback can either echo the
   103 	 *                 partial or return the partial as a string, or return false if error.
   104 	 *               partial or return the partial as a string, or return false if error.
   104 	 */
   105 	 */
   105 	public $render_callback;
   106 	public $render_callback;
   106 
   107 
   107 	/**
   108 	/**
   108 	 * Whether the container element is included in the partial, or if only the contents are rendered.
   109 	 * Whether the container element is included in the partial, or if only the contents are rendered.
   131 	 *
   132 	 *
   132 	 * @since 4.5.0
   133 	 * @since 4.5.0
   133 	 *
   134 	 *
   134 	 * @param WP_Customize_Selective_Refresh $component Customize Partial Refresh plugin instance.
   135 	 * @param WP_Customize_Selective_Refresh $component Customize Partial Refresh plugin instance.
   135 	 * @param string                         $id        Control ID.
   136 	 * @param string                         $id        Control ID.
   136 	 * @param array                          $args      {
   137 	 * @param array                          $args {
   137 	 *     Optional. Arguments to override class property defaults.
   138 	 *     Optional. Array of properties for the new Partials object. Default empty array.
   138 	 *
   139 	 *
   139 	 *     @type array|string $settings All settings IDs tied to the partial. If undefined, `$id` will be used.
   140 	 *     @type string   $type                  Type of the partial to be created.
       
   141 	 *     @type string   $selector              The jQuery selector to find the container element for the partial, that is,
       
   142 	 *                                           a partial's placement.
       
   143 	 *     @type string[] $settings              IDs for settings tied to the partial. If undefined, `$id` will be used.
       
   144 	 *     @type string   $primary_setting       The ID for the setting that this partial is primarily responsible for
       
   145 	 *                                           rendering. If not supplied, it will default to the ID of the first setting.
       
   146 	 *     @type string   $capability            Capability required to edit this partial.
       
   147 	 *                                           Normally this is empty and the capability is derived from the capabilities
       
   148 	 *                                           of the associated `$settings`.
       
   149 	 *     @type callable $render_callback       Render callback.
       
   150 	 *                                           Callback is called with one argument, the instance of WP_Customize_Partial.
       
   151 	 *                                           The callback can either echo the partial or return the partial as a string,
       
   152 	 *                                           or return false if error.
       
   153 	 *     @type bool     $container_inclusive   Whether the container element is included in the partial, or if only
       
   154 	 *                                           the contents are rendered.
       
   155 	 *     @type bool     $fallback_refresh      Whether to refresh the entire preview in case a partial cannot be refreshed.
       
   156 	 *                                           A partial render is considered a failure if the render_callback returns
       
   157 	 *                                           false.
   140 	 * }
   158 	 * }
   141 	 */
   159 	 */
   142 	public function __construct( WP_Customize_Selective_Refresh $component, $id, $args = array() ) {
   160 	public function __construct( WP_Customize_Selective_Refresh $component, $id, $args = array() ) {
   143 		$keys = array_keys( get_object_vars( $this ) );
   161 		$keys = array_keys( get_object_vars( $this ) );
   144 		foreach ( $keys as $key ) {
   162 		foreach ( $keys as $key ) {