Skip to content

Commit 56a7f31

Browse files
author
Daniel Khalil
committed
fix(twig): fixed loader getSourceContext for twig 2.*
1 parent 1cb4311 commit 56a7f31

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/Bacon/Loader.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/**
4-
Copyright 2012-2013 Brainsware
4+
Copyright Brainsware
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.
@@ -20,11 +20,11 @@
2020
namespace Bacon;
2121

2222
/**
23-
* Template loader for Twig so the layout is automatically extended by the
23+
* Template loader for Twig so the layout is automatically extended by the
2424
* main template. This makes '{% extend layout %}' unnecessary.
2525
*
2626
* @package System
27-
*/
27+
*/
2828
class Loader extends \Twig_Loader_Filesystem
2929
{
3030
protected $default_template;
@@ -40,15 +40,15 @@ public function __construct($paths, $default_template, $base_template = true)
4040
$this->base_template = $base_template;
4141
}
4242

43-
public function getSource($name)
43+
public function getSourceContext($name)
4444
{
4545
$source = file_get_contents($this->findTemplate($name));
4646

4747
if ($name == $this->default_template && $this->base_template) {
48-
return '{% extends layout %}' . $source;
48+
return new \Twig_Source('{% extends layout %}' . $source, $name);
4949
}
5050

51-
return $source;
51+
return new \Twig_Source($source, $name);
5252
}
5353
}
5454

0 commit comments

Comments
 (0)