Jump to content

monollonom

Members
  • Content Count

    37
  • Joined

  • Last visited

Community Reputation

35 Excellent

About monollonom

  • Rank
    Jr. Member

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.

  1. @Robin S, bouncing on your mockup, I'm not sure if mixing permanent / appear-on-hover UI is good for the end user. To me, what seems to be the issue is the visual space PW's UI takes and I think it could (partially) be solved by allowing (in the field's settings) to remove the label + padding around it. Mixed with the inline CKEditor, it almost looks like your screenshot, except that it's still clear we're still dealing with "components" that the user can move around.
  2. Hey, My 2 cents on the page layout / builder : about editor.js, I see it more as a nice-looking alternative to CKEditor than something genuinely different in what it offers (apart from for the structured data) and it seems a bit limited to be a page builder more than what is already available to us. And I agree with your pros & cons @ryan. But I do think that adding some improvements to the RepeaterMatrix module, which we all seem to use as a "page builder", is a good way to go. As much as I don't want my clients to have too much freedom when it comes to the layout, I think there could be a way to introduce a "layout abstraction" into RM, something simple and limited, but that could give more flexibility. In a (distant?) way, it would be like giving the user the ability we have, as admins, to define fields' width or group them in a fieldset. I drafted some screenshots to show what I had in mind, that could be "user-friendly" (close to what @Jonathan Lahijani showed in his video). The idea would be to have "layouts" which would be described just like RM items but instead contain abstract "containers". Just like you would with fields, you could change the width of said containers, and make sure they add up to 100%. Then in the page editor where your RM is, you would have the possibility to either add a "layout" or an item. A layout and its containers would reflect the way we described them in the settings, re: width. To show that the layout is something different, we could use the secondary color. And this could be how we translate that into (hopefully not with repeating parts like mine) code: <?php foreach($page->test_matrix as $item) { if($item->type == 'matrix_layout') { // reserved type name if($item->layoutType == 'two-columns') { echo '<div class="grid">'; foreach($item->subItems as $subItem) { echo '<div class="column-1-2">'; if($subItem->type == 'type_text') { echo $subItem->text; } else if($item->type == 'type_image') { echo $subItem->image->render(); } echo '</div>'; } echo '</div>'; } } else if($item->type == 'type_text') { echo $item->text; } else if($item->type == 'type_image') { echo $item->image->render(); } } A few notes : Don't be fooled by my screenshots, I just messed around with Firefox's dev tools. To keep things simpler a layout should not contain another layout. The page editor may become too dense, even unpractical, if there is too much containers. Maybe a toggle on a container to expand it along the horizontal axis could be a solution ? End of my 2 cents. (also : I like how @bernhard is removing the field's label to gain space and I think it could be nice to have such option in the core, like "☑️ Do not display the field's label". Of course it would then remove the ability to collapse the field, but it would be a conscious choice. Edit : this is especially useful in context where you use RM and have 1-field types, like I used in my example above)
  3. I just wanted to be sure that it wasn't me just trying too hard to find a bug for my problem, but I will go ahead and fill one on Github. Thanks again. Edit: we'll see how it goes
  4. Since I'm able to reproduce the error after exactly 60 seconds, this clearly indicates that the wait_timeout MySQL settings of my server is set to 60. A fix could be to increase it, but it doesn't change the fact that the execute function from WireDatabasePDO does not work as advertised. I mean, it does retry to execute the query, but since it's tied to the previously failed PDO connection, it doesn't work as expected. What could be done is to re-prepare the query after the creation of a new PDO connection. However, since you can't access the binded values from the PDOStatement, an idea could be to create a custom PDOStatement (like the one used for debugging), that would keep a track of binded values so that if you recreate the query, you can re-bind the values and thus re-execute the complete query. (at least from my understanding based on the informations I gathered, I might be completely wrong !)
  5. Hi @netcarver, Could you point me out how to check if my code is forking a process ? You're mentioning IDs, from which object could I print it to Tracy ? To me, I am just doing a single thing (create variations) so I don't really see why it would fork. Trying further, and to reproduce the problem using in a simpler case, I managed to trigger a "2006 MySQL server has gone away" using this in the Tracy console : $page->of(false); $title = $page->title; $page->title = "Test"; $page->save(); sleep(60); $page->title = $title; $page->save(); return "ok"; I'm making several tests in the WireDatabasePDO file to see if I can get something out of it.
  6. Hi again, The reason I went for creating a hook generating image variations when uploading was to avoid the "reload the front-end page until you have all your variations generated", because each time I was getting this error "2006 MySQL server has gone away". But it kept happening, even with the splitted ajax calls. I do generate a lot of variations (3 sizes + webp variants for 10+ images per page), so I understand it takes a lot time for Imagick (and memory, both of which I increased) but I'm assuming it shouldn't impact MySQL, especially since the connection is supposed to be closed / recreated up to three times if you get this error. However, reading the code, I can see the connection is correctly closed but is it actually recreated on the next try ? It's obviously getting too technical to me, but my question would be: if a PDOStatement is executed and the connection is closed, does it try to reconnect by itself ? Or I am right assuming there is someting missing here ? Like a new call to the prepare() function, which then recreate the pdo ? It's mostly a question for @ryan but maybe someone else could tell me ? Many thanks in advance ! Edit: Github issue created
  7. Ok I see, thanks @teppo for the informations. In my case it's no big issue to go this way (limiting to ProcessPageEdit) but I don't mind changing back to @adrian's condition in case I come across other "Page editors" like you said.
  8. Thanks for the pointer @adrian ! Here is what I ended up with : <?php class ImageCreateVariations extends WireData implements Module { public static function getModuleInfo() { return array( "title" => "ImageCreateVariations", "version" => 100, "summary" => "", "href" => "", "singular" => true, "autoload" => true ); } public function init() { if ($this->wire('page')->process == "ProcessPageEdit") { $this->addHookAfter("InputfieldFile::fileAdded", $this, "sizeImage"); } else { $this->addHookAfter("Pagefile::install", $this, "sizeImage"); } } public function sizeImage($event) { $inputfield = $event->object; if ($event->method == "install") { $inputfield = $inputfield->pagefiles->getField(); } if ($inputfield->name != "gallery" && $inputfield->name != "image") return; if ($event->method == "install") { $image = $event->object; } else { $image = $event->arguments(0); } $sizes = [300, 600, 1200, 1800]; foreach ($sizes as $size) { $retina = $size * 2; if ($retina >= $image->width) { $image->width(floor($image->width / 2)); break; } $image->width($size); $image->width($retina); } } } I simplified your condition in line 94, but maybe it's the wrong thing to do ? Anyway it now works as expected so thanks again !
  9. Hi, I'm trying to generate variations (for responsive images) when uploading from both the admin and the API, using @Soma hook. However when adding a file using $imageField->add("url"), it doesn't seem to trigger the hook. Am I doing something wrong here ? Should I use another hook ? Thanks.
  10. My apologies, you were also right @Zeka ! As the parent_id does not persist after ___renderAddable, I'm adding the same hook for both functions in my ready.php : $wire->addHookBefore('InputfieldPage::renderAddable', null, "changeParentId"); $wire->addHookBefore('InputfieldPage::processInputAddPages', null, "changeParentId"); function changeParentId($event) { $inputfieldPage = $event->object; $page = $inputfieldPage->hasPage; if($inputfieldPage->hasField == "subcategories") { if ($page->category) { $inputfieldPage->set("parent_id", $page->category->id); } } } And it works great ! Thank you !
  11. Hm this is actually happening when saving the page, while I was looking to be able to show the "Create new" link in the admin panel. Sorry I must have not been clear enough in my post. But you pointed me to the right place to look at, I think I should instead change the parent_id in a beforeHook of https://github.com/processwire/processwire/blob/master/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module#L682
  12. Hi, I'm looking for the right hook to change the parent_id property of an InputfieldPage. I have another InputfieldPage in my template which determines the parent of the selectable pages using this hook : $wire->addHookAfter("InputfieldPage::getSelectablePages", function($event) { $page = $event->arguments(0); if($event->object->hasField == "subcategories") { if ($page->category) { $event->return = $event->pages->find("template=subcategory,parent=$page->category"); } else { $event->return = []; } } }); But in order to be able to create new pages using the field I need to dynamically change the parent_id before it [the field] is created in the edit page. What would be the right hook (or way ?) to do so ? Thanks !
  13. I'm going to have to do the same — migrate a website to Processwire and redirect to new pages’ url if need be — but I thought of using the Page Path History (core) module and its ability to add new redirect URLs per page. Have you tried it ? Have anybody used it that way ?
  14. Thank you for sharing ! I've already had a good read and it's interesting to see your way of dealing with PW. I'm not sure I'm into Twig, but I really like the way you're organising your files and allowing to use composer / nodejs, I'll try that in my next project. I would also be interested to read more about your development flow, like how you deal with git or the transition between local and prod environments.
  15. monollonom

    AZILIS

    Hi all, After seing the website featured in the latest Processwire weekly (thank you @teppo !!), I thought it could be nice to post some details here. I have actually made a few websites using Processwire, but it's the first time I'm posting one in the showcase. Backstory I made a first version of this website in end-2017 when I was starting to use Processwire after a friend recommended it to me. I was in charge of the front/back-end, and helped a bit on the design. At the time there was a slideshow of featured projects as the homepage, the project page was the only template with content blocks, and the information pages (about / contact) were specific templates. About the content blocks, I didn't know about the Repeater Matrix module so I kinda implemented my own, having a simple Repeater with a Select Options field defining which fields to display. All in all the website was pretty nice when it came out and I learned a lot in the process, but this year the agency wanted an update to fit their new narrative, so it was a nice opportunity to make some due changes. Back-end Modules I used : Repeater Matrix ProCache Seo Maestro Email Obfuscation Inputfield Chosen Select Color Minimal Fieldset Page Field Edit Links Runtime Only Tracy Debugger (of course!) This new version is all about content flexibility. The information pages now all share the same template, allowing them to create as many as they want. Each visible templates ("home" / "page" / "project") contains a Repeater Matrix field for content blocks, with 15 different types to choose from and options to add variations in the layout. Front-end To answer to the PW Weekly : it is indeed all custom-made except for three external libraries : plyrjs, flickity and lottiejs. I really like sveltejs but I still have to figure out how I could mix it with PW in my process. The animation in the introduction is described by a .json file and displayed as a SVG using Lottie. The transition colors can be changed. The menu order is defined by the manual sorting in the admin... I don't really know what to say here since it's all hand-made, let me know if you have any question! Screenshots Thanks !
×
×
  • Create New...