Jump to content

bernhard

Members
  • Posts

    6,631
  • Joined

  • Last visited

  • Days Won

    359

Everything posted by bernhard

  1. Needed this today. This is what I used: <?php // on init of a module wire()->addHookAfter('ProcessPageEdit::buildForm', $this, 'moveStatusFieldAndHideSettings'); // the hook method protected function moveStatusFieldAndHideSettings(HookEvent $event): void { // do not change the UI for superusers if (wire()->user->isSuperuser()) return; /** @var ProcessPageEdit $process */ $process = $event->process; $p = $process->getPage(); // check for page template if (!$p->matches('template=basic-page')) return; // get status field /** @var InputfieldWrapper $form */ $form = $event->return; $statusField = $form->get('status'); // add field to content tab $tab = $form ->find("id=ProcessPageEditContent") ->first(); if (!$tab) return; $tab->add($statusField); // remove settings tab both from form and from UI $tab = $form ->find("id=ProcessPageEditSettings") ->first(); if (!$tab) return; $form->remove($tab); $process->removeTab('ProcessPageEditSettings'); }
  2. Hey @FireWire any news on this? Can you reproduce the bug? Let me know if I can help with anything!
  3. A very quick and easy solution would be to add css like this to your admin.less file: li.Inputfield_tmp2 input { margin-top: 30px; } Before: After: You need to adjust the field names in your css though.
  4. Thx for sharing! In case you don't know or anybody is interested in alternatives: RockDevTools is free and provides asset merge/minify plus live reload:
  5. There we are: https://ddev.readthedocs.io/en/latest/users/quickstart/#processwire-zip-file πŸ’–
  6. I'm not sure, but I don't think it supports redirects for subtrees. But you could easily solve that by adding an url hook to /{year}/{page} That hook will not fire for /2025/... as this page exists, and for all other years you can make it look for the page at /oldyears/$year/$page and redirect to that page if it exists.
  7. Ah, thx! That's what I was missing πŸ™‚ It returns only view links which I don't want either. Thx for the clarification πŸ™‚
  8. Thx @adrian that already helps! I missed that comment! This one is interesting. This is not the case for me! I'm also hooking Page::editable and Page::addable and the live search returns non-editable pages as well...
  9. Hey @adrian I had a look into your modules code to see how you restrict search results in the PW backend. I need this for a multisite module I'm building. I took your hook: wire()->addHookAfter('ProcessPageSearch::executeFor', $this, 'hookSearchResults'); ...but wondered why it did not trigger my callback. First I thought the bd() call in the callback might not be working, but turned out the callback was never triggered. So I added a hook recorder and got a log like this: ProcessWire\FieldtypeModule::formatValue ProcessWire\FieldtypeModule::formatValue ProcessWire\ProcessController::execute ProcessWire\FieldsArray::changed ProcessWire\FieldsArray::changed ProcessWire\FieldsArray::changed --- ProcessWire\ProcessPageSearchLive::execute ProcessWire\ProcessPageSearchLive::getDefaultPageSearchFields --- ProcessWire\FieldtypeModule::formatValue ProcessWire\Pages::find ProcessWire\PageFinder::find ProcessWire\PageFinder::getQuery Which made me aware of "ProcessPageSearchLive". I then changed my hook to hook into ProcessPageSearchLive and boom, everything worked as expected. Now I'm wondering why your module only hooks into ProcessPageSearch. Does that even work? Or am I missing something? Thx!
  10. Oh, I was always using + instead of = and it worked as well. Not sure where I picked that up. Yes, manually entering it saves it. But the issue is that when you translate a string and the returned translation is the same (eg Telefon (DE) --> Telefon (CZ)) then fluency will fill the input with "Telefon" which will then be lost on save and the field will be marked as "blank". I think it would be good if it turned "Telefon" into "=" on save. But I think that the core should take care of this! What do you think? PS: No hurry.
  11. Ever felt like your ProcessWire emails look like they're stuck in 1999? You know the drill - sending emails is super easy with WireMail: $m = new WireMail(); $m->from('foo@bar.com'); $m->to('xxx@yyy.com'); $m->subject('Hello there!'); $m->bodyHTML('<h1>This is great!</h1><p>I am an ugly mail...</p>'); $m->send(); But let's be honest - they look about as pretty as a website built with Microsoft FrontPage! πŸ˜… πŸͺ„ Enter the Mail Pimp Hook! Drop this magical hook into your /site/ready.php (or even better Site.module.php), and watch your emails transform from ugly ducklings into beautiful swans: <?php $wire->addHookBefore('WireMail::send', function(HookEvent $event) { // double check that we got a wiremail instance // this also tells the IDE what $mail is (to get IntelliSense) $mail = $event->object; if (!$mail instanceof WireMail) return; // get current mail body $html = $mail->get('bodyHTML'); if (!$html) return; // get email layout markup $layoutFile = wire()->config->paths->templates . 'mails/default.html'; if (!is_file($layoutFile)) return; // replace ##content## with actual mail content $html = str_replace( '##content##', $html, wire()->files->render($layoutFile) ); // write new body to mail $mail->bodyHTML($html); }); The HTML Just create a beautiful MJML template at /site/templates/mails/default.mjml, put ##content## where your email content should go, convert it to HTML and BOOM! πŸ’₯ Every email gets automatically wrapped in your gorgeous template. No more CSS wrestling matches, no more "Why does this look different in Outlook?" headaches. Just pure email beauty, automagically! ✨ Now your clients will think you spent days crafting those emails, when in reality, you're sipping coffee while your hook does all the heavy lifting. Work smarter, not harder! πŸš€ #ProcessWire #EmailMagic #NoMoreUglyEmails PS: This is the MJML template that I used: <mjml> <mj-head> <mj-attributes> <mj-all font-family="Tahoma" /> <mj-text line-height="140%" /> </mj-attributes> </mj-head> <mj-body background-color="#efefef"> <mj-section background-color="#ffffff" background-repeat="repeat" padding-bottom="30px" padding-top="30px" text-align="center" > <mj-column> <mj-image align="center" padding="25px" src="xxx" target="_blank" width="200px" alt="Logo" ></mj-image> <mj-text>##content##</mj-text> </mj-column> </mj-section> <mj-section> <mj-column> <mj-text font-size="10px" color="#a0a0a0" align="center" > powered by <a href="https://www.baumrock.com/" style="color: #158f66" >baumrock.com</a > </mj-text> </mj-column> </mj-section> </mj-body> </mjml> VSCode has an extension to get a live preview and export MJML to HTML: And here are some other free templates: https://mjml.io/templates I use https://www.base64-image.de/ to add the logo to my mail template as src="data:image/jpeg;base64,/9j/4QAWRXhpZgAATU0AKgAAAA..." to avoid headaches with image paths, remote assets blocking etc.
  12. I don't know for sure but I don't think that this is possible. All posts that I found do not mention any solutions either: https://processwire.com/talk/topic/17834-how-to-rtl-admintheme-core-files/ https://processwire.com/talk/topic/7262-ckeditor-rtl/ https://processwire.com/talk/topic/13540-ck-editor-rlt-for-arabic/ (@flydev seems to have tested it) But UIkit supports RTL, so it might be possible?
  13. RockForms v3.0.0 removes RockFrontend dependency for asset loading and uses RockDevTools instead. It also comes with a new config migration that creates a field to select a form (eg from your rockpagebuilder blocks):
  14. @Stefanowitsch I'm proud to announce that this is now also successfully ported to rockdevtools 😎 Note that the syntax changed to grow() and shrink() as it is not any more a RockFrontend feature and AI told me it's safe to use these wordings as they are not used in css/less/sass https://www.baumrock.com/en/processwire/modules/rockdevtools/docs/rockcss/
  15. At the moment I'd recommend simply not to upgrade and use the new RockFrontend + RockDevTools just for new projects.
  16. @FireWire thank you very much! Another little detail I just found: I wanted to translate "Telefon" to EN + CZ. For EN it's "Telephone", fine. For CZ it seems to be "Telefon", the same as in German: Now the problem is that if it is the same and it is saved like this, the field's value is lost: Not sure if that is an issue with your module or rather an issue for Ryan? What do you think? I think it's more a thing that should be handled by the core. When the field is filled out and the same as the default's language value, I think it should automatically save as "+" which tells PW to use the same value as the default.
  17. PS: Thought it might be translation cache, but just flushed the cache and I get the same (wrong) translation 😞
  18. Hey @FireWire any idea why this is not working: Never used this feature before, so I might be doing something wrong? Thx for your help!
  19. Hello and welcome to ProcessWire πŸ™‚ Seems you are lucky - this is my setup that I just shared 4 days ago:
  20. That's wrong. It should either be $rockfrontend or rockfrontend()
  21. RockFrontend will not be deprecated. I need it for every project. I just moved styles() and scripts() and LiveReload to another module. Regarding asset minification: I need that on almost every module that I create. I have some CSS or LESS files in the module's /src folder and I want to compile them to CSS / minified CSS. I did that using RockFrontend, which is not really what the module was built for. Now this is done with RockDevTools. Same for LiveReload. I need LiveReload for development, both on the frontend and on the backend. All the time. But only on my development machine, not on production. That's how RockDevTools works now.
  22. Just released v5.0.0 of RockFrontend LiveReload has been removed (moved to RockDevTools) styles() and scripts() feature has been removed (moved to RockDevTools) RockDevTools is unfortunately not a drop-in-replacement as we had to change how assets are handled and included into the final website markup. The good news is that RockDevTools also supports merging multiple files to one and it will also work with template cache enabled πŸ™‚
  23. Imagine you have a multisite setup where you need different languages for different domains: One website might be single-language (DE only), another one might need DE/EN/CZ, and another one might need DE/EN/HU: I didn't know how to do it, and I didn't find any other posts with a similar need or solution. When looking into the code I even thought that my need was not possible yet without modifying a core file. So I asked Ryan if he was willing to make the process of adding languages to the $languages array hookable. Turns out that this is not necessary! All you have to do is to grab the Iterator of the languages array and remove languages as you need: // /site/ready.php if($anyCondition) { // remove CZ language $languages->getIterator()->remove("name=cz"); } So simple 😍 Maybe it helps πŸ™‚
      • 4
      • Like
      • Thanks
  24. Hi everyone! I've started working on a new module that contains development tools like asset minification. Why a new module when RockFrontend and RockMigrations already have similar features? I wanted to start fresh to make the code cleaner, and most importantly make it work properly with template cache! The old implementation in RockFrontend using page render hooks simply couldn't handle that. The module is intended for development-only and should be disabled on production. The idea is to create minified assets while developing and then push the minified assets to production and there just include them in your markup! LiveReload has also been moved from RockFrontend to this module. It's simply not a frontend-tool but rather a development tool! Using RockMigrations, for example, I'm always using the LiveReload feature on the backend, so it does not really make sense to have it in the frontend module πŸ™‚ Download & Docs: baumrock.com/RockDevTools
Γ—
Γ—
  • Create New...