bp_nouveau_get_temporary_setting( string $option = '', mixed $retval = false )
When previewing make sure to get the temporary setting of the customizer.
Description Description
This is necessary when we need to get these very early.
Parameters Parameters
- $option
-
(Optional) the index of the setting to get.
Default value: ''
- $retval
-
(Optional) the value to use as default.
Default value: false
Return Return
(mixed) The value for the requested option.
Source Source
File: bp-templates/bp-nouveau/includes/functions.php
function bp_nouveau_get_temporary_setting( $option = '', $retval = false ) {
if ( empty( $option ) || ! isset( $_POST['customized'] ) ) {
return $retval;
}
$temporary_setting = wp_unslash( $_POST['customized'] );
if ( ! is_array( $temporary_setting ) ) {
$temporary_setting = json_decode( $temporary_setting, true );
}
// This is used to transport the customizer settings into Ajax requests.
if ( 'any' === $option ) {
$retval = array();
foreach ( $temporary_setting as $key => $setting ) {
if ( 0 !== strpos( $key, 'bp_nouveau_appearance' ) ) {
continue;
}
$k = str_replace( array( '[', ']' ), array( '_', '' ), $key );
$retval[ $k ] = $setting;
}
// Used when it's an early regular request
} elseif ( isset( $temporary_setting[ 'bp_nouveau_appearance[' . $option . ']' ] ) ) {
$retval = $temporary_setting[ 'bp_nouveau_appearance[' . $option . ']' ];
// Used when it's an ajax request
} elseif ( isset( $_POST['customized'][ 'bp_nouveau_appearance_' . $option ] ) ) {
$retval = $_POST['customized'][ 'bp_nouveau_appearance_' . $option ];
}
return $retval;
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |