diff --git a/flextype/core/Entries.php b/flextype/core/Entries.php index e19c2be4..741cf380 100755 --- a/flextype/core/Entries.php +++ b/flextype/core/Entries.php @@ -466,15 +466,15 @@ class Entries */ private function _file_location(string $id) { - $json_file = PATH['entries'] . '/' . $id . '/entry.json'; - $yaml_file = PATH['entries'] . '/' . $id . '/entry.yaml'; + foreach (Parser::$drivers as $driver) { + $driver_file = PATH['entries'] . '/' . $id . '/entry' . '.' . $driver['ext']; - if (Filesystem::has($json_file)) { - return ['file' => $json_file, 'driver' => 'json']; - } - - if (Filesystem::has($yaml_file)) { - return ['file' => $yaml_file, 'driver' => 'yaml']; + if (Filesystem::has($driver_file)) { + return [ + 'file' => $driver_file, + 'driver' => $driver['name'], + ]; + } } return false; diff --git a/flextype/parsers/Parser.php b/flextype/parsers/Parser.php index 09a4ffcb..824d7a81 100644 --- a/flextype/parsers/Parser.php +++ b/flextype/parsers/Parser.php @@ -11,6 +11,16 @@ namespace Flextype; class Parser { + public static $drivers = [ + 'json' => [ + 'name' => 'json', + 'ext' => 'json', + ], 'yaml' => [ + 'name' => 'yaml', + 'ext' => 'yaml', + ], + ]; + public static function encode($input, string $driver) : string { switch ($driver) {