<?php
if(!function_exists('flex_load_blocks')) {
  function flex_load_block_paths() {
    $blocks_config_file = get_template_directory() . '/theme-files/flex-blocks/flex-blocks-config.json';
    if (file_exists($blocks_config_file)) {
      $file_content = file_get_contents($blocks_config_file);
      $blocks = json_decode($file_content, true);
      $blocks_config_file = get_template_directory_uri() . '/theme-files/flex-blocks/blocks-list/';
      $blocks_data = ["blocks" => $blocks, "folder_path" => $blocks_config_file];

      return $blocks_data;
    } else {
      return false;
    }
  }
}

?>