Skip to content

Commit

Permalink
Merge pull request #56 from newfold-labs/fix/site-logo-data
Browse files Browse the repository at this point in the history
Sitegen: Fix Site Logo Data
  • Loading branch information
arunshenoy99 authored Feb 28, 2024
2 parents ef35d08 + 858b325 commit dad5dc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 0 additions & 2 deletions includes/Flows/Flows.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ final class Flows {
'siteLogo' => array(
'id' => 0,
'url' => '',
'fileName' => '',
'fileSize' => 0,
),

// key-value store for social media accounts
Expand Down
13 changes: 8 additions & 5 deletions includes/Services/FlowService.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,15 @@ public static function update_data( $params ) {
\update_option( Options::get_option_name( 'blog_description', false ), $data['data']['blogDescription'] );
}

if ( ( ! empty( $data['data']['siteLogo'] ) ) && ! empty( $data['data']['siteLogo']['id'] ) ) {
\update_option( Options::get_option_name( 'site_icon', false ), $data['data']['siteLogo']['id'] );
\update_option( Options::get_option_name( 'site_logo', false ), $data['data']['siteLogo']['id'] );
if ( ( 'sitegen' === Data::current_flow() && ! empty( $data['sitegen']['siteLogo'] ) ) && ! empty( $data['sitegen']['siteLogo']['id'] ) ) {
update_option( Options::get_option_name( 'site_icon', false ), $data['sitegen']['siteLogo']['id'] );
update_option( Options::get_option_name( 'site_logo', false ), $data['sitegen']['siteLogo']['id'] );
} elseif ( ( ! empty( $data['data']['siteLogo'] ) ) && ! empty( $data['data']['siteLogo']['id'] ) ) {
update_option( Options::get_option_name( 'site_icon', false ), $data['data']['siteLogo']['id'] );
update_option( Options::get_option_name( 'site_logo', false ), $data['data']['siteLogo']['id'] );
} else {
\update_option( Options::get_option_name( 'site_icon', false ), 0 );
\delete_option( Options::get_option_name( 'site_logo', false ) );
update_option( Options::get_option_name( 'site_icon', false ), 0 );
delete_option( Options::get_option_name( 'site_logo', false ) );
}

// Add the version key to the $data before updating to options data.
Expand Down

0 comments on commit dad5dc2

Please sign in to comment.