|
@@ 298-319 (lines=22) @@
|
| 295 |
|
* |
| 296 |
|
* @return null |
| 297 |
|
*/ |
| 298 |
|
protected function _update_theme_mod( $value ) { |
| 299 |
|
|
| 300 |
|
if ( is_null( $value ) ) { |
| 301 |
|
remove_theme_mod( $this->id_data['base'] ); |
| 302 |
|
} |
| 303 |
|
|
| 304 |
|
// Handle non-array theme mod. |
| 305 |
|
if ( empty( $this->id_data['keys'] ) ) { |
| 306 |
|
set_theme_mod( $this->id_data['base'], $value ); |
| 307 |
|
} else { |
| 308 |
|
// Handle array-based theme mod. |
| 309 |
|
$mods = get_theme_mod( $this->id_data['base'] ); |
| 310 |
|
$mods = $this->multidimensional_replace( $mods, $this->id_data['keys'], $value ); |
| 311 |
|
|
| 312 |
|
if ( isset( $mods ) ) { |
| 313 |
|
set_theme_mod( $this->id_data['base'], $mods ); |
| 314 |
|
} |
| 315 |
|
} |
| 316 |
|
|
| 317 |
|
return null; |
| 318 |
|
|
| 319 |
|
} |
| 320 |
|
|
| 321 |
|
/** |
| 322 |
|
* Update the option from the value of the field. |
|
@@ 328-349 (lines=22) @@
|
| 325 |
|
* |
| 326 |
|
* @return bool|null The result of saving the value. |
| 327 |
|
*/ |
| 328 |
|
protected function _update_option( $value ) { |
| 329 |
|
|
| 330 |
|
if ( is_null( $value ) ) { |
| 331 |
|
delete_option( $this->id_data['base'] ); |
| 332 |
|
} |
| 333 |
|
|
| 334 |
|
// Handle non-array option. |
| 335 |
|
if ( empty( $this->id_data['keys'] ) ) { |
| 336 |
|
return update_option( $this->id_data['base'], $value ); |
| 337 |
|
} |
| 338 |
|
|
| 339 |
|
// Handle array-based options. |
| 340 |
|
$options = get_option( $this->id_data['base'] ); |
| 341 |
|
$options = $this->multidimensional_replace( $options, $this->id_data['keys'], $value ); |
| 342 |
|
|
| 343 |
|
if ( isset( $options ) ) { |
| 344 |
|
return update_option( $this->id_data['base'], $options ); |
| 345 |
|
} |
| 346 |
|
|
| 347 |
|
return null; |
| 348 |
|
|
| 349 |
|
} |
| 350 |
|
|
| 351 |
|
/** |
| 352 |
|
* Update the meta from the value of the field. |