Bug #29303
TYPO3\Fluid\View\TemplateView getTemplateRootPath should be public
Status: | Resolved | Start date: | 2011-08-28 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | - | % Done: | 100% |
|
Category: | View | |||
Target version: | - | |||
Has patch: | No | Affected Flow version: | FLOW3 1.0.0 |
Description
if TYPO3\Fluid\View\TemplateView setTemplateRootPath is public then the getTemplateRootPath should be also
The opposite have sense: set as protected and get as public. But if you could write you should be able to read what you have write
Associated revisions
[TASK] Make getTemplateRootPath() public like its setter
The getTemplateRootPath() method in View\TemplateView now
becomes public analogous to its setter counterpart which
already is public, too.
Change-Id: Id41710aa33d880cb0c3aad7280002761368f3586
Resolves: #29303
Releases: master, 2.0, 1.1
[TASK] Make getTemplateRootPath() public like its setter
The getTemplateRootPath() method in View\TemplateView now
becomes public analogous to its setter counterpart which
already is public, too.
Change-Id: Id41710aa33d880cb0c3aad7280002761368f3586
Resolves: #29303
Releases: master, 2.0, 1.1
[TASK] Make getTemplateRootPath() public like its setter
The getTemplateRootPath() method in View\TemplateView now
becomes public analogous to its setter counterpart which
already is public, too.
Change-Id: Id41710aa33d880cb0c3aad7280002761368f3586
Resolves: #29303
Releases: master, 2.0, 1.1
History
#1 Updated by Thomas Allmer almost 4 years ago
I would totally agree to this as if you define the complete path to the template you loose the ability to configure/change it so you would have to create a separate setting which is not very nice usability wise.
If this function gets public you can use it to make it depending on the TemplateRootPath and people are used to change it if needed.
$view = t3lib_div::makeInstance('Tx_Fluid_View_StandaloneView'); // $view->setTemplatePathAndFilename('typo3conf/ext/xform/Resources/Private/Templates/Email/TipAFriend.html'); $view->setTemplatePathAndFilename($this->view->getTemplateRootPath() . 'Email/TipAFriend.html'); $body = $view->render();
#2 Updated by Bastian Waidelich almost 4 years ago
- Category set to View
Thomas Allmer wrote:
In your example $this->view->getTemplateRootPath()
would be NULL as you didn't specify a path.
#3 Updated by Bastian Waidelich almost 4 years ago
Fernando Arconada wrote:
if TYPO3\Fluid\View\TemplateView setTemplateRootPath is public then
the getTemplateRootPath should be also
Hi Fernando,
I agree, that this makes sense in general! We just have to keep this in sync with FLOW3, so please bear with us. In the meantime you could work around this like that:
1$extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); 2$templateRootPath = $extbaseFrameworkConfiguration['view']['templateRootPath'];
#4 Updated by Thomas Allmer almost 4 years ago
Bastian Waidelich wrote:
In your example
$this->view->getTemplateRootPath()
would be NULL as you didn't specify a path.
no it's the root path of the current view... (which is the value from plugin.tx_ext.view.templateRootPath)
$view != $this->view
your workaround certainly works, but it certainly looks like one :p
$this->view->getTemplateRootPath() seems nicer... what do you think? at some point possible or should I drop the idea and always use the "workaround"
#5 Updated by Bastian Waidelich almost 4 years ago
Thomas Allmer wrote:
Bastian Waidelich wrote:
In your example
$this->view->getTemplateRootPath()
would be NULL as you didn't specify a path.no it's the root path of the current view...
(which is the value from plugin.tx_ext.view.templateRootPath)
In this case you used a Tx_Fluid_View_StandaloneView
and that won't know anything about your TS configuration.
your workaround certainly works, but it certainly looks like one :p
$this->view->getTemplateRootPath() seems nicer... what do you think?
at some point possible or should I drop the idea and always use the "workaround"
The thing is: It is already a work around if you need to change the template in an action. I would be interested in a realistic use case here. Having said that, I do think that View variants make sense sometimes. They might make it into the core sometimes. Until then it's just a matter of a few lines to integrate this (see http://forge.typo3.org/projects/typo3v4-mvc/wiki/How_to_change_the_template_for_one_plugin_instance) in your extension. And this looks much less like a work around IMO.
But, still, it might make sense to make getTemplateRootPath() public ;)
#6 Updated by Bastian Waidelich almost 4 years ago
Bastian Waidelich wrote:
no it's the root path of the current view...
(which is the value from plugin.tx_ext.view.templateRootPath)In this case you used a
Tx_Fluid_View_StandaloneView
and that won't know anything about your TS configuration.
I overlooked the $this->
in your example.
And, you're right, for template based emails you have to deal with the template path obviously (see example solution at http://forge.typo3.org/projects/typo3v4-mvc/wiki/How_to_use_the_Fluid_Standalone_view_to_render_template_based_emails)
#7 Updated by Karsten Dambekalns almost 4 years ago
- Affected Flow version set to FLOW3 1.0.0
#8 Updated by Gerrit Code Review over 2 years ago
- Status changed from New to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/16440
#9 Updated by Gerrit Code Review over 2 years ago
Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/19047
#10 Updated by Gerrit Code Review over 2 years ago
Patch set 1 for branch FLOW3-1.1 has been pushed to the review server.
It is available at https://review.typo3.org/19048
#11 Updated by Adrian Föder over 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 0e100edd3ea09247bd887eea93778ce4efdc7284.