Skip to content

Commit

Permalink
StructuredTemplates trait
Browse files Browse the repository at this point in the history
  • Loading branch information
josefbenjac committed Jul 5, 2017
1 parent 201d972 commit f109a27
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/UI/Presenter/StructuredTemplates.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Contributte\Application\UI\Presenter;

use Nette\Application\UI\ComponentReflection;

/**
* Use in Presenter
*/
trait StructuredTemplates
{

/**
* @return string[]
*/
public function formatLayoutTemplateFiles()
{
$presenterReflection = new ComponentReflection(get_called_class());
$presenterDir = dirname($presenterReflection->getFileName());

$parentPresenterReflection = new ComponentReflection(self::class);
$parentPresenterDir = dirname($parentPresenterReflection->getFileName());

//TODO Should it look for a layout on each layer? AbstractPresenter -> AbstractFrontPresenter ...

return [
$presenterDir . '/templates/@layout.latte',
$parentPresenterDir . '/templates/@layout.latte',
];
}

/**
* @return string[]
*/
public function formatTemplateFiles()
{
$presenterReflection = new ComponentReflection(get_called_class());
$presenterDir = dirname($presenterReflection->getFileName());

return [
$presenterDir . '/templates/' . $this->view . '.latte',
];
}

}

0 comments on commit f109a27

Please sign in to comment.