@@ 240-261 (lines=22) @@ | ||
237 | * |
|
238 | * @return null |
|
239 | */ |
|
240 | protected function _update_theme_mod( $value ) { |
|
241 | ||
242 | if ( is_null( $value ) ) { |
|
243 | remove_theme_mod( $this->id_data['base'] ); |
|
244 | } |
|
245 | ||
246 | // Handle non-array theme mod. |
|
247 | if ( empty( $this->id_data['keys'] ) ) { |
|
248 | set_theme_mod( $this->id_data['base'], $value ); |
|
249 | } else { |
|
250 | // Handle array-based theme mod. |
|
251 | $mods = get_theme_mod( $this->id_data['base'] ); |
|
252 | $mods = $this->multidimensional_replace( $mods, $this->id_data['keys'], $value ); |
|
253 | ||
254 | if ( isset( $mods ) ) { |
|
255 | set_theme_mod( $this->id_data['base'], $mods ); |
|
256 | } |
|
257 | } |
|
258 | ||
259 | return null; |
|
260 | ||
261 | } |
|
262 | ||
263 | /** |
|
264 | * Update the option from the value of the field. |
|
@@ 270-291 (lines=22) @@ | ||
267 | * |
|
268 | * @return bool|null The result of saving the value. |
|
269 | */ |
|
270 | protected function _update_option( $value ) { |
|
271 | ||
272 | if ( is_null( $value ) ) { |
|
273 | delete_option( $this->id_data['base'] ); |
|
274 | } |
|
275 | ||
276 | // Handle non-array option. |
|
277 | if ( empty( $this->id_data['keys'] ) ) { |
|
278 | return update_option( $this->id_data['base'], $value ); |
|
279 | } |
|
280 | ||
281 | // Handle array-based options. |
|
282 | $options = get_option( $this->id_data['base'] ); |
|
283 | $options = $this->multidimensional_replace( $options, $this->id_data['keys'], $value ); |
|
284 | ||
285 | if ( isset( $options ) ) { |
|
286 | return update_option( $this->id_data['base'], $options ); |
|
287 | } |
|
288 | ||
289 | return null; |
|
290 | ||
291 | } |
|
292 | ||
293 | /** |
|
294 | * Update the meta from the value of the field. |