Skip to content

Commit

Permalink
Cache is fse
Browse files Browse the repository at this point in the history
  • Loading branch information
PatelUtkarsh committed Jan 27, 2022
1 parent a88a25c commit 2210128
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions theme/inc/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,16 @@ function filter_body_class( $classes ) {
* @return boolean
*/
function is_fse() {
static $material_is_in_fse_mode;
if ( isset( $material_is_in_fse_mode ) ) {
return $material_is_in_fse_mode;
}
$material_is_in_fse_mode = false;
if ( file_exists( get_stylesheet_directory() . '/theme.json' ) ) {
$theme_json = file_get_contents( get_stylesheet_directory() . '/theme.json' );
$theme_json = json_decode( $theme_json, true );
if ( isset( $theme_json['customTemplates'] ) || isset( $theme_json['templateParts'] ) ) {
return true;
}

return false;
$theme_json = file_get_contents( get_stylesheet_directory() . '/theme.json' );
$theme_json = json_decode( $theme_json, true );
$material_is_in_fse_mode = isset( $theme_json['customTemplates'] ) || isset( $theme_json['templateParts'] );
}

return false;
return $material_is_in_fse_mode;
}

0 comments on commit 2210128

Please sign in to comment.