Skip to content

Commit

Permalink
Default to .yaml format. Also check for .txt format
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviocopes committed Apr 26, 2016
1 parent 438ef06 commit 35bed67
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions data-manager.php
Expand Up @@ -123,8 +123,12 @@ public function onPluginsInitialized()
*/
private function getFileContentFromRoute($type, $fileRoute) {

//Single item details
$fileInstance = File::instance(DATA_DIR . $type . '/' . $fileRoute . $this->config->get('plugins.data-manager.types.' . $type . '.file_extension', '.txt'));
//get .yaml file
$fileInstance = File::instance(DATA_DIR . $type . '/' . $fileRoute . $this->config->get('plugins.data-manager.types.' . $type . '.file_extension', '.yaml'));

if (!$fileInstance->content()) { //try using .txt if not found
$fileInstance = File::instance(DATA_DIR . $type . '/' . $fileRoute . $this->config->get('plugins.data-manager.types.' . $type . '.file_extension', '.txt'));
}

if (!$fileInstance->content()) {
//Item not found
Expand Down

0 comments on commit 35bed67

Please sign in to comment.