Source
File: wp-includes/customize/class-wp-customize-partial.php
final public function render( $container_context = array() ) {
$partial = $this;
$rendered = false;
if ( ! empty( $this->render_callback ) ) {
ob_start();
$return_render = call_user_func( $this->render_callback, $this, $container_context );
$ob_render = ob_get_clean();
if ( null !== $return_render && '' !== $ob_render ) {
_doing_it_wrong( __FUNCTION__, __( 'Partial render must echo the content or return the content string (or array), but not both.' ), '4.5.0' );
}
/*
* Note that the string return takes precedence because the $ob_render may just\
* include PHP warnings or notices.
*/
$rendered = null !== $return_render ? $return_render : $ob_render;
}
/**
* Filters partial rendering.
*
* @since 4.5.0
*
* @param string|array|false $rendered The partial value. Default false.
* @param WP_Customize_Partial $partial WP_Customize_Setting instance.
* @param array $container_context Optional array of context data associated with
* the target container.
*/
$rendered = apply_filters( 'customize_partial_render', $rendered, $partial, $container_context );
/**
* Filters partial rendering for a specific partial.
*
* The dynamic portion of the hook name, `$partial->ID` refers to the partial ID.
*
* @since 4.5.0
*
* @param string|array|false $rendered The partial value. Default false.
* @param WP_Customize_Partial $partial WP_Customize_Setting instance.
* @param array $container_context Optional array of context data associated with
* the target container.
*/
$rendered = apply_filters( "customize_partial_render_{$partial->id}", $rendered, $partial, $container_context );
return $rendered;
}