Jump to content

monollonom

Members
  • Posts

    275
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by monollonom

  1. There wasn’t so much nesting in my case but I did have an issue I resolved using $pages->parents()->rebuildAll(). Maybe try this first? Otherwise I think you’d need to be more specific regarding your setup.
  2. Adding my grain of salt to this (I just faced this situation), you can also leave the Label field to the default "title" and change it temporarily (though you need to set it back once the inputfield is rendered): $wire->addHookAfter("InputfieldPage::getSelectablePages", function(HookEvent $event) { if($event->object->hasField != "yourField") return; $pages = $event->return; foreach($pages as $page) { $page->originalTitle = $page->title; $page->title = "Custom title based on $page->someField"; } $event->addHookAfter("Inputfield::render", function(HookEvent $event) use ($pages) { foreach($pages as $page) { $page->title = $page->originalTitle; } $event->removeHook(null); }); $event->return = $pages; }); (not sure though how this would behave in your setup @Pete)
  3. If you don’t see an output as a guest user it means there was an error trying to convert the MJML code. Is there a way you could share your code? A screenshot maybe?
  4. I’d still go with the EasySVG one. From what I'm seeing, though more “recent”, this library lacks the “font to paths” part that the other provides with .svg font files. Please let us know once you’ve handled this, I’m curious 🙂
  5. (funnily I just went through the same question regarding showing a custom font in a svg) If you want your svg to show the font when displaying it through an <img> tag you will need to have it embedded as a base64, as mentionned in your SO link. My take on what you want to achieve is something along the lines of what I described here: With transfonter, you could generate a .svg version of the font file you're using and then build the svg with the icon and module name using this php library. I haven’t tested it so I can’t vouch for it but I would try this way first.
  6. Regarding uploading from URL(s) you could check @Robin S’ AddImageUrls
  7. Quick message to say the small tutorial literally saved me just now. I'm going to install the module asap and get back to working. Phew
  8. Also note that strftime has been deprecated in PHP 8.1. Here’s a topic with alternatives:
  9. I guess it depends on the way you structure your templates. In my case I never rely on CKEditor / TinyMCE as a way for the client to structure the page’s content, I actually mostly use them just so they can put links and eventually set in bold or italic. So if I want them to be able to add videos (where I want them to) this is the module I use. To me if you have a video within your template that is on its own (not within a text) then you could definitely use both. Edit: here’s an example within a repeater matrix with image/video types: (french says: "Go full-bleed?" / "Is it an external video?" / "Play automatically?" (I then str_replace the embed code to add the autoplay)) Sorry about this but this is what I meant yes 🙂
  10. https://github.com/neuerituale/FieldtypeOembed#field-preview I‘m not the author but in my case I use it when users need to be able to add an external video (or audio) to a page and I want to make sure they properly copied the video link. I always have a dedicated field for such videos so I have no use for a TextFormatter that would do something similar in a textarea. Also the field comes with various informations that I use: width/height, poster’s url, ... One other (albeit weird) use I have of this module is to put it as an image’s custom field so that I can replace an image by a video when I have a gallery with both pictures and videos. Though note that in order for this to work you have to allow this Fieldtype in the FieldtypeFile config page and also make a small change in PW core until Ryan accepts my PR. Also there’s no GDPR since it’s up to you to output the iframe’s code (the `html` prop).
  11. Alright, latest version is now published and available through the Upgrade module. Thanks again!
  12. Ah! You uncovered my evil plan to put my website on every newsletter generated from my module 🥸 Joke aside, thanks for spotting this one, it was because of $page->getText returning an empty string when there were no {brackets} in the string. I also spotted another bug if you left the "ignore" textarea empty. Here’s the updated file. Let me know if you notice anything else and otherwise I’ll publish the release! Edit: noticed and fixed another small issue with slashes (if missing in the custom host, or if the relative url doesn’t start with one) It shouldn’t make any difference indeed but thank you anyway for sharing your usage of the module!
  13. Following the previous addition to convert relative URLs into absolute ones I quickly needed to ignore some that weren’t just starting with either "http", "tel" or "mailto" but were also keywords from mailing tools such as "*|UNSUBSCRIBE|*". However I also did some changes in the module’s config, mostly for clarity but also to avoid a call to the MJML API on every save. So before I publish a new release, I wouldn’t mind if any users (@wbmnfktr, @szabesz?) would try it out in a local environment and confirm everything is still working (it is on my side) before I create a new release and update it in the module directory. Thanks!
  14. This is great to read! And I think it’s only fair to think about ways to make it sustainable for you. I’m not 100% sure I would need the Pro version but just for the sake of supporting your great module I wouldn’t mind paying that extra. This is a thing I really (reeeeeally) like with Ryan’s Pro modules model: provide an excellent base and sell this nice extra bit (that can be big) to allow to support the work. Now, I’m close to start working on a client’s website where I will be using your module (of course) and I have some questions: do you happen to have an ETA for this update? will the update process be smooth between the current version and the new one? I assume it will be but I prefer asking. finally: would you recommend to wait to get TinyMCE support? Thanks again for the great work and looking forward for the release.
  15. New very small release fixing a bug introduced in the previous one: it was falsely calling httpUrl on a string when prepending a custom host to relative URLs.
  16. Actually the cached files are cleared if they are expired but only through a LazyCron: (from the ProCache’s page) In other words, if you still have apache running and your database is down, you should not have to worry, so long as your website is fully cached.
  17. Best would be to use ProCache which does exactly this. You just have to select the template you want cached and update your .htaccess so your server serves the generated page’s HTML. Edit: note though that the page needs to be visited for it to be cached
  18. Small FYI: apparently I was wrong... I updated my local setup to 3.0.217 and after refreshing the modules I got a notification inviting me to choose which copy of the duplicate module to use: This was after I confirmed but by default it seemed to have the core one selected. Though there are no problems to report because of this
  19. It wouldn’t be too difficult using ProcessWireUpgradeCheck::getModuleVersions. You can also have a look at ProcessWireUpgradeCheck::loginHook to see how it's used. Something like: $wire->addHook("LazyCron::everyMonth", function(HookEvent $event) { $checker = $event->modules->get("ProcessWireUpgradeCheck"); if(!$checker) return; $upgrades = $checker->getModulesVersions(true); // we only want modules with new versions if(!count($upgrades)) return; $subject = "There are " . count($upgrades) . " modules to update on $config->httpHost"; $body = "Hi!\n\nAn upgrade is available for these modules on $config->httpHost:\n\n"; foreach($upgrades as $name => $info) { $body .= "- $name ($info[remote])\n"; } $body .= "\nHead to " . $event->pages->get("process=ProcessWireUpgrades")->url . " to upgrade"; // not sure if this `get` would work? $mail = new wireMail(); $mail->from("upgrade@$config->httpHost") ->to("you@mail.com") ->subject($subject) ->body($body) ->send(); }); (non tested code written from my phone, so please forgive the formatting and/or mistakes 😅)
  20. Normally copies of core modules inside the site modules’ folder take precedence, so in your case the core TinyMCE module should just be ignored.
  21. Haven't used it yet but I think this is something you can control in the module’s (or even in the field’s?) settings with the pastefilter whitelist:
  22. lol entirely forgot I provided the exact same answer... at least I'm consistent 🙃
  23. Have you tried hooking after your module’s ___upgrade() ? You could also put your code in there like I did for one of mine
  24. I'm only dealing with video, but this is the latest I used: <?php // greatest common divisor function gcd($a, $b) { return $b ? gcd($b, $a % $b) : $a; } $padding = $video->height / $video->width * 100; $padding = str_replace(",", ".", $padding); // css doesn’t like commas $ratio = gcd($video->width, $video->height); $ratio = $video->width / $ratio . " / " . $video->height / $ratio; echo "<div class='video' style='aspect-ratio:$ratio; padding-top:$padding%;'>$video->html</div>"; CSS: .video { aspect-ratio: 16 / 9; width: auto; max-width: 100%; height: auto; max-height: 100%; padding-top: 56.25%; } .video > iframe { display: block; width: 100%; height: 100%; position: absolute; left: 0; top: 0; } /* if aspect-ratio is supported */ @supports (aspect-ratio: 16/9) { .video { padding-top: 0 !important; } .video > iframe { position: static; } } Constraining things in the y-axis has always been one of my biggest pain in CSS... but aspect-ratio goes in the right direction in that you can just go ahead and set the max-width/height to 100% and it will adapt nicely within its parent Wait actually some testing goes against what I just wrote, I have to test further 🫣 It does work but as always with CSS there will be weird edge cases. I wasn't using it much before but now the support is quite reasonnable.
  25. I just pushed a new release adding a new option I needed: the ability to automatically convert relative urls into absolute ones. You can also choose the host to prepend or any query parameters to append. More infos in the settings.
×
×
  • Create New...