Last active
January 6, 2023 14:46
-
-
Save putzflorian/219f582377b20d64d97ea9d8751dbb89 to your computer and use it in GitHub Desktop.
Migrate Php templates to Twig for Pimcore X
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __PARTS__ | |
| Methods (required!!!) | |
| ((?:render|extends|include)\s*\(?\s*(?:'|")):? | |
| Level | |
| (?:((?:\w|-|_)+)(?::|\/)) | |
| Last Level (required!!!) | |
| (?:((?:\w|-|_)+)(?::|\/)?) | |
| Extension (required!!!) | |
| (\.html\.twig) | |
| Advanced (if other code is in between the template string) | |
| ('.+') | |
| __PLACEHOLDERS__ | |
| Methods | |
| $1 (no / after) | |
| Level x | |
| $x+1/ | |
| Last Level x | |
| $x+1 (no / after) | |
| Extension | |
| $x (no / slash before) | |
| Advanced | |
| $x (position in string) | |
| __BASIC STRUCTURE__ | |
| Find | |
| Methods Levels(times x) Last Level Advanced(if needed) Extension | |
| Replace | |
| $1$2/....$x$x+1$x+2 | |
| __SHORT__ | |
| ((?:render|extends|include)\s*\(?\s*(?:'|")):?(?:((?:\w|-|_)+)(?::|\/))(?:((?:\w|-|_)+)(?::|\/)?)(\.html\.twig) | |
| $1$2/$3$4 | |
| __MEDIUM__ | |
| ((?:render|extends|include)\s*\(?\s*(?:'|")):?(?:((?:\w|-|_)+)(?::|\/))(?:((?:\w|-|_)+)(?::|\/))(?:((?:\w|-|_)+)(?::|\/)?)(\.html\.twig) | |
| $1$2/$3/$4$5 | |
| __LARGE__ | |
| ((?:render|extends|include)\s*\(?\s*(?:'|")):?(?:((?:\w|-|_)+)(?::|\/))(?:((?:\w|-|_)+)(?::|\/))(?:((?:\w|-|_)+)(?::|\/))(?:((?:\w|-|_)+)(?::|\/)?)(\.html\.twig) | |
| $1$2/$3/$4/$5$6 | |
| __HUGE__ | |
| ((?:render|extends|include)\s*\(?\s*(?:'|")):?(?:((?:\w|-|_)+)(?::|\/))(?:((?:\w|-|_)+)(?::|\/))(?:((?:\w|-|_)+)(?::|\/))(?:((?:\w|-|_)+)(?::|\/))(?:((?:\w|-|_)+)(?::|\/)?)(\.html\.twig) | |
| $1$2/$3/$4/$5/$6$7 | |
| __ADVANCED__ | |
| ((?:render|extends|include)\s*\(?\s*(?:'|")):?(?:((?:\w|-|_)+)(?::|\/))(?:((?:\w|-|_)+)(?::|\/)?)('.+')(\.html\.twig) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello @kovinet!
If you have stumbled across this collection during the update of Pimcore 6.9 to Pimcore X keep in mind:
renderandincludefunctionalities).{% extends ':Layout:default.html.twig' %}to{% extends 'Layout/default.html.twig' %}<?=).TLDR; no it does not migrate PHP templates to twig templates but updates the Twig namespace syntax.
Good luck with the update!