Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
516 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/Symfony/Bundle/FrameworkBundle/Templating/TemplateReference.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien.potencier@symfony-project.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bundle\FrameworkBundle\Templating; | ||
|
||
use Symfony\Component\Templating\TemplateReference as BaseTemplateReference; | ||
|
||
/** | ||
* Internal representation of a template. | ||
* | ||
* @author Victor Berchet <victor@suumit.com> | ||
*/ | ||
class TemplateReference extends BaseTemplateReference | ||
{ | ||
public function __construct($bundle = null, $controller = null, $name = null, $format = null, $engine = null) | ||
{ | ||
$this->parameters = array( | ||
'bundle' => $bundle, | ||
'controller' => $controller, | ||
'name' => $name, | ||
'format' => $format, | ||
'engine' => $engine, | ||
); | ||
} | ||
|
||
/** | ||
* Returns the path to the template | ||
* - as a path when the template is not part of a bundle | ||
* - as a resource when the template is part of a bundle | ||
* | ||
* @return string A path to the template or a resource | ||
*/ | ||
public function getPath() | ||
{ | ||
$controller = $this->get('controller'); | ||
$path = (empty($controller) ? '' : $controller.'/').$this->get('name').'.'.$this->get('format').'.'.$this->get('engine'); | ||
|
||
return empty($this->parameters['bundle']) ? 'views/'.$path : '@'.$this->get('bundle').'/Resources/views/'.$path; | ||
} | ||
|
||
} |
Oops, something went wrong.