View Issue Details

IDProjectCategoryView StatusLast Update
13678Feature requests[All Projects] Pluginspublic2018-08-07 17:01
ReporterDenisChenuAssigned ToDenisChenu 
PrioritynoneSeverityfeature 
Status closedResolutionfixed 
Product Version 
Target VersionFixed in Version 
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.

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

manager   ~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