mirror of
https://github.com/flextype/flextype.git
synced 2025-08-19 11:21:30 +02:00
This commit is contained in:
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user