Leaderboard
Popular Content
Showing content with the highest reputation on 07/01/2024 in all areas
-
As this episode is kinda funny (at least the first part) I thought I'd share it will all of us: The ProcessWire Truck On the road from Berlin to Vienna (for those who don't know: Austria is on its way to win the EURO2024 Soccer Championship ?) this truck with combination of the baumrock hexagon and the ProcessWire logo instantly caught my attention. Unfortunately I didn't see if Ryan was driving it... ? ? Rock Module Updates ? Now let's get serious! As always we're bringing you the latest module updates to enhance your web development experience. Discover what's new and stay at the forefront of technology with ProcessWire and baumrock.com RockFrontend v3.18.0 Add PR by @gebeer catching an error if $refs is null due to network problems. Thx! Also inspired by a conversation with @gebeer we now have a $rockfrontend->ajax flag that is true if either $config->ajax is true or the request is an HTMX request (where $config->ajax would be false) Improvements to ALFRED (prevent modal on double clicks on links and buttons) Made loadTwig() hookable so you can add your own Twig functions easily. Thx @Spinbox for the suggestion! RockMigrations v4.5.0 You can now disable ProCache on development via $config->disableProcache = true; in your config[-local].php The Deployment class has been updated to read config from a php file. This opens the door for even more automated workflows (eg choosing the right php version directly from the remote server). RockShell v3.1.0 Fixes RockShell loading commands from dot-folders and causing errors when trying to load the same class twice. Improves the "ddevadmin" command to not rely on superuser id 41 RockPageBuilder v5.5.3 Fixes text selection when dragging blocks caused by a recent Chrome update Fixes the shipped Accordion block causing an endless loop on the demo-page. Marks newly added blocks as "temporary" until they are saved at least once. This fixes the problem that when a client clicked on "create new block" on the frontend but then just closed the modal he/she didn't see this block unless he/she reloaded the page. From now on this block will automatically be hidden until the block itself has been saved. Adds inline-checkbox settings. Get RockPageBuilder Here RockForms v1.5.1 Addes support for multi-step forms ?? This update was necessary for RockCommerce checkouts and initially I put all the code there, but I thought it's much better placed in RockForms so we can use multi-step forms wherever we need them ? Get RockForms Here Others RockCommerce: A lot of work has gone into the further development of RockCommerce. Getting product variations done alone was a huge task and took a complete re-write of RockGrid, which is in a really good shape now ? Other modules that have been improved for RockCommerce are RockMollie (for integrating mollie.com payments into ProcessWire) and RockMoney (for handling currency values). Next month I'll be focusing on the cart functionality! That's a wrap for this month, rockstars! ?✨ May your projects compile without errors, your documentation be crystal clear, and your coffee always be strong enough to power your late-night coding sessions. Keep rocking the web, stay curious, and happy coding! Bernhard ?2 points
-
To render the screen you showed, this happens: ProcessPageAdd::execute() is called. This is hookable, so you could mangle its markup output, but it’s going to be disgusting. Because neither parent nor template were given, execute() now calls renderChooseTemplate() and immediately returns its result. renderChooseTemplate() is not hookable. Within renderChooseTemplate(), ProcessPageAdd::executeNavJSON() is called. This is hookable, but it’s not going to be very useful. executeNavJSON() – surprise – doesn’t return json but an associative PHP array containing, among other things, the templates you’re allowed to add. It will sort these alphabetically by name using ksort(). Back in renderChooseTemplate(), the allowed parents for each of these templates are now queried using this selector: $pages->find("template=$parentTemplates, include=unpublished, limit=100, sort=-modified") So now you know why Nadelholzbalken is #1: it was most recently modified. Also it’s hardcoded to only show 100 pages. Both are not easily changed. So yeah, you’re basically stuck with post-processing the output of ProcessPageAdd::execute() and being limited to the 100 most recently modified pages. Alternatively you could build the list yourself. It’s only a bunch of links to ./?template_id=123&parent_id=4567 after all. Something like this: $this->addHookBefore("ProcessPageAdd::execute", function(HookEvent $event) { $process = $event->object; if (input()->get('template_id') || input()->post('template_id')) return; if (input()->get('parent_id') || input()->post('parent_id')) return; //we weren’t given a parent or a template, so we build our own list $event->replace = true; $templates = $process->executeNavJSON(array('getArray' => true))['list']; $out = ''; foreach($templates as $tpl_data) { if(empty($tpl_data['template_id'])) continue; $template = templates()->get($tpl_data['template_id']); if (!$template) continue; $out .= "<h3><a href='./?template_id={$template->id}'>{$template->name}</a></h3>"; $parentTemplates = implode('|', $template->parentTemplates); if(empty($parentTemplates)) continue; $parents = pages()->find("template=$parentTemplates, include=unpublished, sort=title"); $out .= '<ul>'; foreach($parents as $p) $out .= "<li><a href='./?template_id={$template->id}&parent_id={$p->id}'>{$p->title}</a></li>"; $out .= '</ul>'; } $event->return = $out; }); Obviously this looks like ass, but functionally that’s the gist of it.2 points
-
I've no idea how to tweak that. But you could also create a custom backend page, see here.2 points
-
I've worked around this by running LoginRegister's processes on another template, so all good for me now ??1 point
-
Yes, encapsulation is a very important concept to read about, I forgot to mention it in my message. Yes, the book is written based on neuroscientific knowledge that facilitates learning, and it works incredibly well. Before I read this book, I had been trying to understand Design Patterns for weeks or months through discussions on forums with good developers, web tutorials... But I couldn't understand anything, I saw no point in coding DPs. Then I received this book, read 2 or 3 chapters the first evening, it was very exciting to read, I dreamed all night of boxes connecting together (classes/objects), and the next morning I understood everything! ??1 point
-
I second this wholeheartedly. It's truly too much to cover in a comment, but this is what I mean when I said "thinking with objects". It requires starting to work with encapsulation and breaking down/dividing your code into behavioral chunks. I'm pretty sure at some point I read the book that @da² recommended. The Head First series really does explain things in ways that I have seldom seen elsewhere. Also +1 for real life books, I find that they let me "unplug" from the problem at hand and focus on the content presented. In my closing list of items I mentioned "single responsibility", "composition over inheritance", "does not expose how it calculates", and an example of how properties and methods can each have their purposes and roles. You're going to immediately be introduced to these fundamental concepts as soon as you start down the OOP path, I peppered them in to contextualize them in ProcessWire. I've referenced this site before and it's a good next step. You'll write OOP code and sometimes think "there's got to be a better way to do this", and these are the abstract concepts that you'll be able to take into consideration. Just be mindful of "premature optimization" and get comfortable with OOP to the point where before you even start coding, your mental model will naturally begin with OOP. Approach LLMs with caution while learning. They require that you ask a question the right way and may not tell you why what you asked maybe isn't the right question to ask in the way a human can. You also have to be familiar enough with the concepts to recognize when they give you the wrong answer. LLMs require large scale data ingestion and that means their models are indiscriminately built with code examples whether they're good or bad. You'll get there but they're wrong, a lot, so maybe consider this one a little further down the road. Just my two cents.1 point
-
It's not exactly the same technique, but I have just got into this rabbit hole and after a bit of blood sweat and tears and help from a pal, this is working for me while using ProCache and using the nonce attribute on scripts. This configuration assumes you have mod_substitute and mod_cspnonce installed. <If "%{THE_REQUEST} !~ m# /processwire/?#"> Options +Includes AddOutputFilterByType SUBSTITUTE;INCLUDES text/html Substitute "s|--CSP-NONCE--|<!--#echo var=\"CSP_NONCE\" -->|i" # Customize to your needs Header add Content-Security-Policy "default-src 'self' 'nonce-%{CSP_NONCE}e'; </If> Place this at the end of the ProcessWire htaccess directives. This should swap on the fly the Apache response and replace any --CSP-NONCE-- script. Then on Apache you can also set the nonce headers like this: I do not use this because my server setup uses nginx as reverse proxy. For example: <script nonce="--CSP-NONCE--" src="https://totally-safe-website.com"></script> Will end up as: <!-- nonce swapped on every request! --> <script nonce="0O4I3O5nNFG/MVpqormzyIuH" src="https://totally-safe-website.com"></script> @ryan fyi In theory, this would be A LOT simpler in Apache 2.5, since you could put an expression within the Substitute directive instead of the server side includes to substitute the "--CSP-NONCE--" script, but right now I'm limited to Apache 2.4 in the setup where I need this since I don't have control of the stack versions. So this should work in Apache 2.4+1 point