Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Smarty and Twig template engines #3452

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from

Conversation

samerton
Copy link
Member

@samerton samerton commented Oct 1, 2023

TODO

  • Error pages
  • Widgets class
  • ???

@samerton samerton added this to the 2.2.0 milestone Oct 1, 2023
@samerton samerton added enhancement design Related to CSS or design labels Oct 1, 2023
@samerton samerton force-pushed the feature/template-engine branch from df6ac87 to 9a1a437 Compare June 8, 2024 14:11
@samerton samerton marked this pull request as ready for review June 8, 2024 14:11
@samerton samerton force-pushed the feature/template-engine branch from f0d1b08 to 5d7274a Compare December 10, 2024 18:59
core/includes/maintenance.php Show resolved Hide resolved
core/includes/tfa_signin.php Show resolved Hide resolved
modules/Cookie Consent/module.php Outdated Show resolved Hide resolved
modules/Core/module.php Outdated Show resolved Hide resolved
'file_exists',
'array_key_exists',
];
$securityPolicy->secure_dir = [ROOT_PATH . '/custom/templates', ROOT_PATH . '/custom/panel_templates'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm i have a issue as Store module modifies $securityPolicy->secure_dir to view its template files for gateways / connections etc

Now i wont be able to modify $securityPolicy anymore

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you modify securityPolicy currently?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gateways work same way as template settings where the template files is stored inside the gateways folder, Like how templates do

So its change the secure dir when gateways page is loaded
$securityPolicy->secure_dir = [ROOT_PATH . '/modules/Store', ROOT_PATH . '/custom/panel_templates'];


$smarty->setCompileDir(ROOT_PATH . '/cache/templates_c');

if ($panelTemplate) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded now :S I have a upcoming module and private modules thats adding another dashboard

It should be path instead of Boolean to continue allowing modules to add new dashboards

Copy link
Member Author

@samerton samerton Jan 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does your module initialise a new instance of Template, with your template files in a custom directory?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TemplateBase yea, It might still work without using this new way as its still load Smarty directly like how templates used to do

In this case the directory is /custom/dashboard_templates/

*/
public function __construct(string $template)
{
$loader = new FilesystemLoader(ROOT_PATH . '/custom/templates/' . $template);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also allow path here if people wanna make panel templates or templates for other module releated dashboards in Twig???

@samerton samerton force-pushed the feature/template-engine branch from 3cbe64b to dbedd68 Compare January 12, 2025 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Related to CSS or design enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants