mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Allow recursive includes in i18nTextCollector (fixes #8133)
This commit is contained in:
parent
9ffd25225e
commit
d918c26782
@ -289,7 +289,7 @@ class i18nTextCollector extends Object {
|
||||
*
|
||||
* @todo Why the type juggling for $this->collectFromTemplate()? It always returns an array.
|
||||
*/
|
||||
public function collectFromTemplate($content, $fileName, $module) {
|
||||
public function collectFromTemplate($content, $fileName, $module, &$parsedFiles = array()) {
|
||||
$entities = array();
|
||||
|
||||
// Search for included templates
|
||||
@ -299,11 +299,12 @@ class i18nTextCollector extends Object {
|
||||
$includeFileName = "{$includeName}.ss";
|
||||
$filePath = SSViewer::getTemplateFileByType($includeName, 'Includes');
|
||||
if(!$filePath) $filePath = SSViewer::getTemplateFileByType($includeName, 'main');
|
||||
if($filePath) {
|
||||
if($filePath && !in_array($filePath, $parsedFiles)) {
|
||||
$parsedFiles[] = $filePath;
|
||||
$includeContent = file_get_contents($filePath);
|
||||
$entities = array_merge(
|
||||
$entities,
|
||||
(array)$this->collectFromTemplate($includeContent, $module, $includeFileName)
|
||||
(array)$this->collectFromTemplate($includeContent, $module, $includeFileName, $parsedFiles)
|
||||
);
|
||||
}
|
||||
// @todo Will get massively confused if you include the includer -> infinite loop
|
||||
|
Loading…
x
Reference in New Issue
Block a user