Skip to content

Commit

Permalink
Update the settings controller to use the API from the coming soon mo…
Browse files Browse the repository at this point in the history
…dule
  • Loading branch information
wpscholar committed Jan 17, 2024
1 parent b015497 commit 70f155c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions inc/RestApi/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Bluehost\RestApi;

use function NewfoldLabs\WP\ModuleLoader\container;

/**
* Class SettingsController
*/
Expand Down Expand Up @@ -67,8 +69,11 @@ public function update_item( $request ) {
$new_value = $params[ $setting ];
switch ( $setting ) {
case 'comingSoon':
$new_value = ( $new_value ) ? 'true' : 'false';
update_option( 'nfd_coming_soon', $new_value );
if ( $new_value ) {
container()->get( 'comingSoon' )->enable();
} else {
container()->get( 'comingSoon' )->disable();
}
break;
case 'autoUpdatesMajorCore':
$new_value = ( $new_value ) ? 'true' : 'false';
Expand Down Expand Up @@ -170,7 +175,7 @@ public function get_current_settings() {
}

$settings = array(
'comingSoon' => ( 'true' === get_option( 'nfd_coming_soon', 'false' ) ),
'comingSoon' => container()->get( 'comingSoon' )->is_enabled(),
'autoUpdatesAll' => $major && $plugins && $themes,
'autoUpdatesMajorCore' => $major,
'autoUpdatesMinorCore' => $minor,
Expand Down

0 comments on commit 70f155c

Please sign in to comment.