Leaderboard
Popular Content
Showing content with the highest reputation on 03/02/2021 in all areas
-
What we need is really easy ways to contribute and build motivation towards contributions. - slack/discord for real-time Comms - merging PRs in the Processwire repo instead of the weird closing the PR and copy pasting it in. I raised a PR years ago, got no feedback and was told it may have fine in via copy and paste. I closed the PR myself to reduce noise and haven't entertained the idea of contributing since. Unless this has changed, start treating it like a modern open source project - roadmap on the GitHub board - indentified maintainers on the GitHub repo - a backlog / causal kanban style agile setup - monthly maintainer video calls to go over backlog etc. Maybe anyone can join. Maybe video recorded. - a patron or way to donate to the PW project. This pot can be used to pay maintainers to work on critical features etc. E.g. through donations with have enough money to fund 1 week of work, what should Ryan / another maintainer take time off their normal work to work on. - key goals established for the core maintainer team. We should as a whole be marching the same direction. (Though obviously people can work on what they want, but has to pass review) - a plan that @ryan is comfortable with to slowly distribute the reigns. We don't want to move too fast and over burden the core. - some sort of backlog voting system, instead of posts on the forum. - Id really like to modernise the process around Processwire. That scares anybody larger than a sole freelancer away from the project. Bigger users mean more support. More pro modules being sold etc. - on that note. Can we have the shop not just be Ryan's modules but extended to other pais for modules. I don't like that they are strewn across the web. (And Ryan charge a fee.)2 points
-
Just wanted to share what I recently used to create forms in modules and in frontend using the API and Inputfield modules PW provides and uses on its own. I think many newcomers or also advanced user aren't aware what is already possible in templates with some simple and flexible code. Learning this can greatly help in any aspect when you develop with PW. It's not as easy and powerful as FormBuilder but a great example of what can be archieved within PW. Really? Tell me more The output markup generated with something like echo $form->render(); will be a like the one you get with FormBuilder or admin forms in backend. It's what PW is made of. Now since 2.2.5~ somewhere, the "required" option is possible for all fields (previous not) and that makes it easier a lot for validation and also it renders inline errors already nicely (due to Ryan FormBuilder yah!). For example the Password inputfield already provides two field to confirm the password and will validate it. De- and encryption method also exists. Or you can also use columns width setting for a field, which was added not so long ago. Some fields like Asm MultiSelect would require to also include their css and js to work but haven't tried. Also file uploads isn't there, but maybe at some point there will be more options. It would be still possible to code your own uploader when the form is submitted. Validation? If you understand a little more how PW works with forms and inputfields you can simply add you own validation, do hooks and lots of magic with very easy code to read and maintain. You can also use the processInput($input->post) method of a form that PW uses itself to validate a form. So getting to see if there was any errors is simply checking for $form->getErrors();. Also the $form->processInput($input->post) will prevent CSRF attacks and the form will append a hidden field automaticly. It's also worth noting that processInput() will work also with an array (key=>value) of data it doesn't have to be the one from $input->post. Styling? It works well if you take your own CSS or just pick the inputfields.css from the templates-admin folder as a start. Also the CSS file from the wire/modules/InputfieldRadios module can be helpful to add. And that's it. It's not very hard to get it display nicely. Here an code example of a simple form. <?php $out = ''; // create a new form field (also field wrapper) $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'subscribe-form'); // create a text input $field = $modules->get("InputfieldText"); $field->label = "Name"; $field->attr('id+name','name'); $field->required = 1; $form->append($field); // append the field to the form // create email field $field = $modules->get("InputfieldEmail"); $field->label = "E-Mail"; $field->attr('id+name','email'); $field->required = 1; $form->append($field); // append the field // you get the idea $field = $modules->get("InputfieldPassword"); $field->label = "Passwort"; $field->attr("id+name","pass"); $field->required = 1; $form->append($field); // oh a submit button! $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Subscribe"); $submit->attr("id+name","submit"); $form->append($submit); // form was submitted so we process the form if($input->post->submit) { // user submitted the form, process it and check for errors $form->processInput($input->post); // here is a good point for extra/custom validation and manipulate fields $email = $form->get("email"); if($email && (strpos($email->value,'@hotmail') !== FALSE)){ // attach an error to the field // and it will get displayed along the field $email->error("Sorry we don't accept hotmail addresses for now."); } if($form->getErrors()) { // the form is processed and populated // but contains errors $out .= $form->render(); } else { // do with the form what you like, create and save it as page // or send emails. to get the values you can use // $email = $form->get("email")->value; // $name = $form->get("name")->value; // $pass = $form->get("pass")->value; // // to sanitize input // $name = $sanitizer->text($input->post->name); // $email = $sanitizer->email($form->get("email")->value); $out .= "<p>Thanks! Your submission was successful."; } } else { // render out form without processing $out .= $form->render(); } include("./head.inc"); echo $out; include("./foot.inc"); Here the code snippet as gist github: https://gist.github.com/4027908 Maybe there's something I'm not aware of yet, so if there something to still care about just let me know. Maybe some example of hooks could be appended here too. Thanks Edit March 2017: This code still works in PW2.8 and PW3.1 point
-
I have one simple question regarding "move" function in tree view: It is pretty obvious how to move a page to another node that already has childrens or change order of slibings. But how to move a page under a node without any children? In the above context - how to move "Child page example 2" under "Child page example 1" - as a new child? Sorry if this is some kind of common knowledge, but I'm completely new to PW, for me this is deal breaker feature, and I'm unable to figure it out myself.1 point
-
There might be a better approach, but this snippet in site/ready.php works for me: <?php namespace ProcessWire; $wire->addHookBefore('ProcessPageLister::execute', function(HookEvent $event) { if($event->page->process != "ProcessUser") return; # Put all fields that should be searchable by default here: $userSearchFields = ['email']; # We create a comma separated field selector string from the array above for use by ProcessPageLister $searchFieldsString = implode('', array_map(function($f) { return ", $f="; }, $userSearchFields)); $lister = $event->object; # ProcessUser appends the ", roles=" selector before our hook happens, so we inject our fields # before that part: $lister->defaultSelector = preg_replace( '/(?=, roles=)/', $searchFieldsString, $lister->defaultSelector ); }); ProcessPageLister builds its field list from the selector style string its $defaultSelector property. So you just need to put the names of your fields into the $userSearchFields array and ProcessPageLister will take care of the rest. If you want to completely replace the search field list, it's even simpler. <?php namespace ProcessWire; if($event->page->process != "ProcessUser") return; # Put all fields that should be searchable by default here: $userSearchFields = ['lastname', 'firstname']; # We create a comma separated field selector string from the array above for use by ProcessPageLister $searchFieldsString = implode(', ', array_map(function($f) { return "$f="; }, $userSearchFields)); $lister = $event->object; $lister->defaultSelector = $searchFieldsString; }1 point
-
Finally did it, thank you @Jan Romero. There is something not quite intuitive here, I must say ;) Anyway I'm happy it works, I'd like to dig deeper into ProcessWire. It looks so fresh and straightforward in front of "big brothers", like WP, Drupal, etc.1 point
-
Hi, there is an issue about this on Github that you may want to upvote: https://github.com/processwire/processwire-issues/issues/1102. It also includes a tiny fix that has been working for me.1 point
-
Hi @aComAdi - sorry about the problem with Tracy. You know, this is one of those strange things I have seen with Tracey on and off over the years. I actually just came across it again today, for the first time in a long time and @Robin S just PM'd me about it as well. In his case, it was the Field List & Values section in the RequestInfo panel, which once disabled fixed it for him. For me it's when an image called on the frontend is not available. The weird thing I've noticed in the past is if I load all Tracy panels, then the problem goes away. I'd like to finally get this sorted out though. I thought I was the only one ever seeing it ? I'll try to take another look soon, but I'd like to know if disabling the Field List & Values section fixes it for you, or if it is related to a missing image. Thanks for your help in narrowing this down.1 point
-
This could be because TracyDebugger loads Logfiles (by default?), namely Tracy Logs and ProcessWire Logs. If these files are large, it could take a while and make the site unresponsive. Try to disable them in Tracy's panel selector and see if that helps.1 point
-
I third that. It can be very helpful for ProcessWire long term development. Gideon1 point
-
Long time no post. Here's my latest: https://maisliberdade.pt/ Mais Liberdade is a liberal think-tank in Portugal, promoting the values of liberal-democracy, individual freedom and free market economy. It's a non profit that gathers collaboration from people from multiple portuguese political parties, members of the european parliament, economists, professors, etc. During development, an announcement page was set up with a registration form for founding members. In that period of about a month, around 200 subscriptions were expected, but in the end we got over 6000 subscribers. This website features essays, events, videos and a free library that, at the time of this post is counting 400 books. The frontend was built using web components (Stencil js). Basic pages are built with a modular approach, I'm attaching a video of how they are created. The approach is a simple repeater with a custom block type selector interface. That selector is basically a modified version of FieldtypeSelectFile. I've hacked that module to expect a PNG to be available for each PHP file in the blocks folder, and modified the input field to generate a button grid after the select. This is lovely to use from the editor's perspective, but it's something to improve for the developer experience, because in the end this is a repeater, that has to contain all fields that each type of block needs, and for each of those fields I have to set it to show only if the blockType field equals X, Y or Z. With a lot of different block types this takes some planning and easily becomes hard to manage, but it's the best approach I found yet and the benefit for the editor's experience is well worth it. covered-compressed.mp41 point
-
Maybe you are calling your hook late. Have a look at the code in the first post of the following thread, just below the /site/templates/includes/hooks.php sub-heading1 point
-
1 point