Jump to content

monollonom

Members
  • Posts

    176
  • Joined

  • Last visited

  • Days Won

    2

monollonom last won the day on December 2 2021

monollonom had the most liked content!

1 Follower

Contact Methods

  • Website URL
    https://eprc.studio

Profile Information

  • Gender
    Male
  • Location
    Brussels

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

monollonom's Achievements

Sr. Member

Sr. Member (5/6)

225

Reputation

  1. Seems like you could also hook into WireFileTools::include, which is used behind $files->include or $files->render, maybe you could do the same check / filename replacement there. (as per my edit in the previous message I managed to not only miss an important point but also the fact you already had a similar code... 🙄)
  2. Ah, somehow I missed the part where you said you needed to fallback should the file not be there, my bad! Edit: I even missed the fact you already had a similar code 😑 From what I'm reading in PW’s source code, you could hook before TemplateFile::render (...time passing doing tests...) I think the best is to check if the dev’s file exists and then use setFilename() in init.php: wire()->addHookBefore("TemplateFile::render", function(HookEvent $event) { /** @var TemplateFile $tpl */ $tpl = $event->object; $userTpl = str_replace("templates/", "templates-dev/" . $event->user->name, $tpl->filename); if(file_exists($userTpl)) { $tpl->setFilename($userTpl); } }); Try and let me know if it works for you!
  3. I actually share a similar setup but for another use (templates-dev is for local development / preview) and in my case I use this in my config.php: $config->urls->templates = $config->urls->site . "templates-dev/"; $config->paths->templates = $config->paths->site . "templates-dev/"; $config->urls->fieldTemplates = $config->urls->site . "templates-dev/fields/"; $config->paths->fieldTemplates = $config->paths->site . "templates-dev/fields/"; Similar to what @androbey suggested. However I don’t switch based on the user but it's easy to do so in your site/init.php if($user->name === "username") { // ... } elseif($user->name === "admin") { // ... }
  4. In this case, best is to simply go with either an "if" or "switch" statement, something like: $datum = $concert->date; $format = "E, d. LLLL yyyy, HH:mm"; switch($user->language->name) { case "deutsch": $lang = "de-DE"; $format = "EE dd.MM.YYYY"; break; case "français": $lang = "fr_FR"; break; case "default": $lang = "en_US"; break; } $fmt = new \IntlDateFormatter($lang, \IntlDateFormatter::FULL); $fmt->setPattern($format); echo $fmt->format($datum);
  5. You mean the multi-lang site profile? I assume your default language is English then, did you try the code I gave you? The important part is replacing new \IntlDateFormatter('DE', with: new \IntlDateFormatter($user->language->isDefault() ? "en_US" : "de-DE" And if it happens to be the wrong way around, just invert "en" and "de".
  6. @Thomas -Allwinds Webstudio when creating your IntlDateFormatter, do you set the locale based on the user’s language or is hard-coded like in your code sample? It depends on how you named your languages or which one is your default but maybe it could be: $datum = $concert->date; $fmt = new \IntlDateFormatter($user->language->isDefault() ? "en_US" : "de-DE", \IntlDateFormatter::FULL ); $fmt->setPattern('E, d. LLLL yyyy, HH:mm'); echo $fmt->format($datum);
  7. I just came across this issue and the solution is pretty simple: replace strftime() with date("YmdHMS", $seconds) I don't really understand the use of strftime() here since there's no use of language-dependent strings... @horst Could you have a look at this or would you rather accept a PR?
  8. Hi @adrian, would you consider adding your fork in the module directory so we can update it using ProcessWireUpgrade? That would be great!
  9. I have the same case where I use a start date and an end one. I add a hook that checks the end date when saving the page and if undefined it copies the start date value, this way you can sort using the end date.
  10. If you're on Mac, you can try/buy https://www.araelium.com/screenflick-mac-screen-recorder. I'm just using it for basic screen recording but it seems it could do what you need (except for "append videos" maybe), plus it can be simple enough.
  11. @wbmnfktr I'm not using @bernhard’s tool but you could go this way to have your initial migrate.php: $rm = $modules->get("RockMigrations"); $excludedFields = ["admin_theme", "pass", "permissions", "process", "roles"]; $fieldsCode = []; foreach($fields as $field) { if(in_array($field->name, $excludedFields)) continue; $fieldsCode[] = $rm->getCode($field); } $fieldsCode = "\$rm->migrate(\"fields\" => [\n" . implode(",\n", $fieldsCode) . "\n];"; $excludedTemplates = ["admin", "permission", "role", "user"]; $templatesCode = []; foreach($templates as $template) { if(in_array($template->name, $excludedTemplates)) continue; $templatesCode[] = $rm->getCode($template); } $templatesCode = "\$rm->migrate(\"templates\" => [\n" . implode(",\n", $templatesCode) . "\n];"; And export $fieldsCode and $templatesCode in a file. Regarding the verbosity, it unfortunately boils down to how PW generates the export data. You could be pretty agressive and skip all falsy values but you might get unexpected behaviour.
  12. TagsToFolders Github: https://github.com/eprcstudio/TagsToFolders Modules directory: https://processwire.com/modules/tags-to-folders/ This is a small helper tool to visually organise fields/templates into folders in the menu when they are tagged. This is a simple module that can help you declutter your templates/fields menu by organising them in folders using tags. I initially envisionned this module to be used for cases where fields and/or templates were created by modules and thus not polute the ones created by the user.
  13. I've made yet another update, re: minification part + I came back to adding the debug view right after <body> like I did before, otherwise it did weird stuff to the layout. But this time I made sure my replace also handle cases where the <body> tag has an attribute, to counter the issue you had @wbmnfktr.
×
×
  • Create New...