-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
1 parent
201d972
commit f109a27
Showing
1 changed file
with
45 additions
and
0 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
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', | ||
]; | ||
} | ||
|
||
} |