diff --git a/application/models/TemplateConfiguration.php b/application/models/TemplateConfiguration.php index f6f7235625e..bfcb7ad7f8a 100644 --- a/application/models/TemplateConfiguration.php +++ b/application/models/TemplateConfiguration.php @@ -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 *