diff --git a/flextype/Fieldsets.php b/flextype/Fieldsets.php index 0d306efe..64b4a8b6 100644 --- a/flextype/Fieldsets.php +++ b/flextype/Fieldsets.php @@ -31,6 +31,32 @@ class Fieldsets $this->flextype = $flextype; } + /** + * Fetch fieldsets + * + * @access public + * @param string $id Fieldsets id + * @return array|false The entry contents or false on failure. + */ + public function fetch(string $id) + { + $fieldsets_file = Fieldsets::_file_location($id); + + if (Filesystem::has($fieldsets_file)) { + if ($fieldsets_body = Filesystem::read($fieldsets_file)) { + if ($fieldsets_decoded = JsonParser::decode($fieldsets_body)) { + return $fieldsets_decoded; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } + /** * Fetch Fieldsets for current theme *