Customize: Skip exporting partials to client and handling rendering requests if user can't modify associated settings.

Introduces `WP_Customize_Partial::check_capabilities()` for parity with `WP_Customize_Control::check_capabilities()`.
 
See #27355.
Fixes #35914.


git-svn-id: https://develop.svn.wordpress.org/trunk@36643 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter
2016-02-23 18:13:30 +00:00
parent 380e94f1ee
commit c9b47e9d92
4 changed files with 68 additions and 5 deletions

View File

@@ -172,7 +172,9 @@ final class WP_Customize_Selective_Refresh {
$partials = array();
foreach ( $this->partials() as $partial ) {
$partials[ $partial->id ] = $partial->json();
if ( $partial->check_capabilities() ) {
$partials[ $partial->id ] = $partial->json();
}
}
$exports = array(
@@ -356,7 +358,7 @@ final class WP_Customize_Selective_Refresh {
$partial = $this->get_partial( $partial_id );
if ( ! $partial ) {
if ( ! $partial || ! $partial->check_capabilities() ) {
$contents[ $partial_id ] = null;
continue;
}