Skip to content

Commit

Permalink
Dev: added TemplateConfiguration::getValidScreenFiles()
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jun 23, 2017
1 parent 279e987 commit d1549c1
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion application/models/TemplateConfiguration.php
Expand Up @@ -134,9 +134,32 @@ public function getTemplateURL()
return $this->sTemplateurl;
}

/**
* Used from the template editor.
* It returns an array of editable files by screen for a given file type
*
* @param string $sType the type of files (view/css/js)
* @return array array ( [screen name] => array([files]) )
*/
public function getValidScreenFiles($sType = "view")
{
$aScreenFiles = array();
$filesFromXML = (array) $this->templateEditor->screens->xpath('//file');

foreach( $filesFromXML as $file){

if ( $file->attributes()->type == $sType ){
$aScreenFiles[] = (string) $file;
}
}

$aScreenFiles = array_unique($aScreenFiles);
return $aScreenFiles;
}

/**
* This function will update the config file of a given template so that it extends another one
*
*
* It will:
* 1. Delete files and engine nodes
* 2. Update the name of the template
Expand Down

0 comments on commit d1549c1

Please sign in to comment.