View Issue Details

IDProjectCategoryView StatusLast Update
13678Feature requests[All Projects] Pluginspublic2018-05-16 17:36
ReporterDenisChenuAssigned ToLouisGac 
PrioritynoneSeverityfeature 
Status feedbackResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary13678: Allow to add and/or replace Twig file by plugins
DescriptionIn plugin we can need to show content to public user , or replace content by default
Additional InformationCode 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)

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