Skip to content

Commit

Permalink
Dev: added TemplateConfiguration::extendsFile()
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jun 28, 2017
1 parent 72f1301 commit e146c91
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions application/models/TemplateConfiguration.php
Expand Up @@ -198,6 +198,21 @@ public function getFilePathForEdition($sFile, $aAllowedFiles=null)
return $this->getFilePath($sFile, $this);
}


public function extendsFile($sFile)
{

if( !file_exists($this->path.'/'.$sFile) && !file_exists($this->viewPath.$sFile) ){

// Copy file from mother template to local directory
$sRfilePath = $this->getFilePath($sFile, $this);
$sLfilePath = (pathinfo($sFile, PATHINFO_EXTENSION) == 'twig')?$this->viewPath.$sFile:$this->path.'/'.$sFile;
copy ( $sRfilePath, $sLfilePath );
}

return $this->getFilePath($sFile, $this);
}

/**
* This function will update the config file of a given template so that it extends another one
*
Expand Down

0 comments on commit e146c91

Please sign in to comment.