View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
13678Feature requestsPluginspublic2018-08-07 17:01
ReporterDenisChenu Assigned ToDenisChenu  
PrioritynoneSeverityfeature 
Status closedResolutionfixed 
Summary13678: Allow to add and/or replace Twig file by plugins
Description

In plugin we can need to show content to public user , or replace content by default

Additional Information

Code is ready : https://gitlab.com/SondagesPro/twigExtendByPlugins/blob/master/ExtendedETwigViewRenderer.php#L151

Here i need to event : because i don't have a way to replace "core" twig and allow template to replace it

In current situation : force + add is easy, but since we don't have a real 'core' part, more difficult.

A solution can be move

  • Move vanilla to ./views/ : it became the last last one

We include in this order (without plugins)
$loader->addPath("application.views");
$loader->addPath($oRTemplate->viewPath);
while ($oRTemplate->oMotherTemplate instanceof TemplateConfiguration) {
$oRTemplate = $oRTemplate->oMotherTemplate;
$loader->addPath($oRTemplate->viewPath);
}

And with plugins :
$loader->addPath("application.views");
// New or replaced twig core file , always replaced by any template, but always replace core
foreach((array)$oEvent->get("TwigExtend") as $configTwigExtend) {
if(is_string($configTwigExtend) && trim($configTwigExtend) != "") {
$loader->addPath($configTwigExtend);
}
}
$loader->addPath($oRTemplate->viewPath);
while ($oRTemplate->oMotherTemplate instanceof TemplateConfiguration) {
$oRTemplate = $oRTemplate->oMotherTemplate;
$loader->addPath($oRTemplate->viewPath);
}

TagsNo tags attached.
Bug heat4
Story point estimate
Users affected %

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2018-05-16 17:36

developer   ~47654

Just to have your advice here (i make the pull request with current situation, but maybe improve it for 4.X (move vanilla views to application/views)

markusfluer

markusfluer

2018-08-07 17:01

administrator   ~48734

Release 3.14.2+180807

Issue History

Date Modified Username Field Change
2018-05-16 17:35 DenisChenu New Issue
2018-05-16 17:36 DenisChenu Assigned To => LouisGac
2018-05-16 17:36 DenisChenu Status new => feedback
2018-05-16 17:36 DenisChenu Note Added: 47654
2018-06-29 00:55 DenisChenu Assigned To LouisGac => DenisChenu
2018-06-29 00:55 DenisChenu Status feedback => resolved
2018-06-29 00:55 DenisChenu Resolution open => fixed
2018-08-07 17:01 markusfluer Status resolved => closed
2018-08-07 17:01 markusfluer Note Added: 48734