Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/15/2022 in all areas

  1. This week on the dev branch are several updates to the comments system including support for custom fields on comments (which we're calling comment meta data). I'm currently working on a site that uses a reviews system powered by BazaarVoice. It's pretty nice but it's also very expensive (I think at least $500/month in this case). The system powers their reviews which include not just a rating and review text, but also a bunch of other criteria that the user can provide. See an example here — click the "Reviews" tab and what you see there now is currently coming from BazaarVoice. But in a couple of weeks you should see the same thing powered by ProcessWire. Think of this like a comments system with custom fields. That's not something that ProcessWire has supported before, but now this week it does. Though I know most don't need this, so have kept it pretty simple, focusing just on adding API methods to make it possible to get and set custom field values for any comment. These include: $comment->getMeta('name'); $comment->setMeta('name', $value); $comment->removeMeta('name'); The name and $value can be whatever you decide. There's also a bonus $comment->meta() method which combines the methods, letting you get or set, kind of like the meta() method on Page objects. If you want to use comment meta data like this, it's exclusively an API feature. So if you are looking to collect custom fields from users, you'll want to implement your own comment form rather than the default. In our case, we'll be using FormBuilder to implement the comment form that includes the review and custom fields. But you could just as easily use a homegrown form. When it comes to outputting that custom data, you'll want to handle it more like you would outputting a repeater, iterating through the $page->comments and then using $comment->getMeta('name'); for each of the custom properties you want to output. Worth noting is that output formatting doesn't come into play here, so if some text in the meta data needs to be entity encoded for output (for example) then that's your responsibility. How about later editing of the meta data? Should you need it, the ProcessCommentsManager module (Setup > Comments) has been upgraded to support editing of comment meta data. Next to each comment is now a "Meta" link, and if you click it, you'll get a modal window on top of the comment enabling you to edit the meta data as JSON. That might seem a little unconventional, but I'm trying to keep it simple and flexible. Most will probably use this to view meta data rather than edit it, but the ability is there when/if needed. I didn't think it would be worth spending the significant time building a full-blown page-editor like environment for editing comment meta data, but also felt like I needed something like this for occasional editing needs. The InputfieldCommentsAdmin module was also updated to have meta data links for each comment. But the reality is if you have ProcessCommentsManager installed, chances are you aren't editing comments in the page editor anyway. So a new option has been added in the comments field configuration (Input tab) enabling you to disable comments in the page editor and instead link to the editor in the comments manager. When enabled, your Comments field in the page editor would instead look like this: This is worthwhile because the comments manager is just a better place to view/edit comments in the admin since it is paginated, supports editing of all properties, and lets you sort/filter as you see fit. Whereas a big list of comments in the page editor just slows it down. This week the CKEditor version has been upgraded to 4.19.0 (see release notes). I'm also emailing with the people at CKEditor about getting us a license to use CKEditor 5 with ProcessWire. As you may or may not know, the CKEditor 5 license (LGPL) isn't compatible with ProcessWire's license (MPL2 and MIT), so we are working on a license agreement to make it possible. Since CKEditor 4 will reach EOL in 2023 it's a good time to start planning for CKEditor 5 and I'm excited to work with it. Thanks for reading and have a great weekend!
    9 points
  2. Hello @toni, yes this is possible with the Repeater Matrix fields. They are part of the commercial ProFields, but I think they are worth their money. I use the Repeater Matrix for almost every project nowadays. ? Regards, Andreas
    5 points
  3. Bump. This is now in the modules directory! ? The first post has been updated with current details.
    3 points
  4. A lot has changed since RockMigrations1. The new version is a lot easier to use! https://github.com/baumrock/RockMigrations RockMigrations was built for exactly that use case. I started in 04/2019 - so the module and its concepts have been developed, evaluated and improved for 3 years now and I'm using it in production for all of my websites. <?php namespace ProcessWire; /** @var RockMigrations $rm */ $rm = $this->wire->modules->get('RockMigrations'); // We make structural changes like adding a new page template on the local, $rm->createTemplate("your_new_template"); // adding a couple of fields in an existing one, $rm->setTemplateData("your_existing_template", [ 'fields' => [ 'title', 'body', 'add_existing_field1', 'add_existing_field2', ], ]); // changing settings on a field and whatnot, $rm->setFieldData('your_existing_field', [ 'label' => 'Your new field label', 'columnWidth' => 50, ]); Steep learning curve? I don't know... You have IntelliSense and it comes with migration snippets for VSCode and it comes with code inspector to copy and paste the syntax: # on local git push # on remote either login as superuser and reload the page # or for automated deployments just use the CLI: php /path/to/your/site/modules/RockMigrations/migrate.php
    3 points
  5. Hi @Jacques! Welcome to the forums! I'd say the easiest would be to install it with composer if you are able to install composer and I'd argue that it's worth the investment in time to learn a bit of composer! At least just to run a composer require command, which is all you need right now! Have you seen this blog post?? https://processwire.com/blog/posts/composer-google-calendars-and-processwire/#installing-the-module-with-composer You don't need to install composer on the server, composer will download dependencies in a folder called /vendor in the installation's root folder and you can upload this folder just fine to the server. I would be really hard to break the site by just doing "composer require square/square", but in any case it does happen after that command, just delete the vendor folder. Are you familiar with CLI tools?? Maybe it's the first step! To learn how to execute a CLI program?? Are you on mac or windows?? If you're on mac I might be able to help. I see a manual installation guide to on square docs page! Did you see that? It might suite best with the knowledge you have now, though you'd need to adapt it to your own templates. Development aside, looking at the actual problem, maybe Pro module FormBuilder would be helpful if you have the budget to spend on it, and instead of Square you could use Stripe and that might might just be and almost plug and play solution depending on additional logic that do want to handle. Don't hesitate to come back and ask even if it seems like something "super obvious" or "dumb" in your view, this is a welcoming community for everyone no matter their experience.
    3 points
  6. Looks like access control issue ? Can you try: $pages->get("name=reports")->children("check_access=0,report_meta_details.report_type.title=Global")->each("report_meta_details.report_type.title"); I wonder, if you try this one, does it behave the same way? $pages->find("parent.name=reports, report_meta_details.report_type.title=Global")->each("report_meta_details.report_type.title");
    2 points
  7. Generally speaking I second what Bernhard said above. Custom tables are rarely a good idea — though there are some exceptions ? Now, as for your error: As the error states, the problem is not that you don't have access to $database — that part works just fine. The issue is that in this case $database does not provide a method called "getIndexes". This method was added in ProcessWire 3.0.182, so the first thing to check is your ProcessWire version. If it's earlier than 3.0.182, this error is expected. If it's a later one, then we can continue debugging from there. Also, as a loosely related note, the use of getIndexes() seems a bit odd here. Usually one would use $database->getColumns() (which, just for the record, was added in ProcessWire 3.0.180) to display column names/labels ?
    2 points
  8. Do you really want to create a custom DB table? You can do that if you want/need to do it, but usually working with PW pages and the PW API is a lot more convenient. The API is easier to develop and use and also you get the benefit of a GUI for editing your data. Instead of creating a table in the DB I'd suggest you create two templates: orders, order Then you set the family settings of orders and order so that order is the only allowed child of orders and orders is the only allowed parent for order. Then you add fields to your "order" template: product (page reference field), customer_name (text), customer_address (textarea), customer_email (email) You don't need order_date, because PW stores the created timestamp of every page that you can use for that. Then you create your table with PW API: <?php $out = "<table>"; $orders = $this->wire->pages->find("template=order, limit=20"); foreach($orders as $order) { $out .= "<tr><td>$order</td><td>{$order->customer_name}</td></tr>"; } $out .= "</table>"; You can also use MarkupAdminDataTable but I don't know the correct syntax by heart ? Pagination can be tricky... Adding pages would be like this: <?php $p = new Page(); $p->template = 'order'; $p->parent = $pages->get("/orders"); $p->title = 'order XY'; $p->product = $yourproduct; $p->customer_name = 'John Doe'; ... $p->save();
    2 points
  9. You just need a plain equals sign. $pages->find("template=adebate, deb_inter=$page->id"); And usually I just use $page alone because the string value of a Page object is its ID. $pages->find("template=adebate, deb_inter=$page");
    2 points
  10. Very good advice. You might also like to try my ProcessDbMigrate if you don't want to go the RockMigrations route. However it does struggle with some fields - like nested repeaters. I have temporarily paused developing it while I review the best way forward, but you are welcome to try it and I will try and provide support for any problems. See the support thread here and the github here.
    2 points
  11. You can access it like: $this->database->getIndexes('my_table') Or wire('database')->getIndexes('my_table'); EDIT: Your code seems correct ? Can you paste the error thrown?
    2 points
  12. Hello, I'm primarily a graphic designer with some intermediate php coding skills. I love everything about Processwire; how easy it is to get up and running, making a lot of things that are hard (at least to me), very easy to implement. In fact, it makes me look like a genius most of the time ( I deal with a lot of Imposter Syndrome, but anyways . . .). I'm trying to figure out how to install Square's SDK and API into a processwire site I'm developing for my wife. I've read a lot of tutorials and articles, and I'm afraid to make some horrible error that will break what I've already built (I just recently learned how to use Regions with confidence). I don't know if I should install Composer or not ( I don't understand Composer, do I install only locally on my computer, or actually have to install it on the server?) or do I just manually install the SDK on the server itself, but where? Not the root folder, I know that much and how do I call it in the files (in the config.php or in the _init.php). She's an esthetician, I'd like users to be able to book appointments on the site and her able to make those appointments to deposit a percentage to hold the appointment. So that is my issue. Would love some help and keep learning to get better with using Processwire.
    1 point
  13. Hi Community, I hope this very basic hasn't been asked before. As with processwires repeater fields Wordpress has the option to add unlimited content items to an article. The difference is, with processwire repeater field authors can add a defined set of inputs fields. For example ten headline and body items. With Wordpress I can do the same (see screenshot below), but the User can choose which content/input type should be added. So instead of adding a bunch of headline and body fields, authors are free to choose for example a headline followed by an image gallery followed by an article Text followed by an image description … Is it possible to do something similar with processwire repeaters (or an other field type) that allows authors to "build" their needed content structure (without creating a new template that definies the exact fields)? Thanks for your help, Toni
    1 point
  14. BTW, you don’t need write “name=” here, $pages->get('reports') should be sufficient, unless you like the added clarity.
    1 point
  15. I think you could use just $page->references('template=adebate') to get the debates that reference this speaker. See the blog post ProcessWire 3.0.107 core updates
    1 point
  16. That's awesome! Locally, I'm using Windows 11, with Xamp, Sublime Text and Filezilla. The server runs standard Linux. Years ago I had some practice with Git, but it's been so long that I forgot a lot of it. I know enough PHP and Vanilla Javascript to get into trouble, but not enough to get out of trouble in most cases. But I'm trying! I'll let you know how it goes. Thanks for the confidence boost.
    1 point
  17. @Clarity - Settings Factory should technically support what any module config would; i've never seen repeater fields used in a module config screen, probably because repeaters require the use of hidden pages. So for now this module would need to stay limited to those fields whose values can be stored in text/json;
    1 point
  18. Thank you so much. Another reason why Processwire is great, because of the community here. I will re-read the post about installing the module with composer now that I know that I don't need to also upload Composer or install Composer on the server. Thank you for that. I have used CLI tools before when I would play around with Linux Mint or Ubuntu, not so much on Windows (which is what I use now because I need Photoshop). As for something else other than Square, my wife is pretty committed to using Square. Thank you so much.
    1 point
  19. Yes, but the module is still in deep development. It's kind of never ending, but I have put a lot of consistent time into it over the last month. I'm at mostly the refactoring stage now as I have gotten in most of the features I want. I am stripping out experimental ideas that just didn't feel right, such as the 3rd approach in my video (too overcomplicated). Page builders are... not difficult to develop but easy to overcomplicate. To be clear, my module is not going to be just a page builder (although that is a large part of it). It's essentially my vision of a highly opinionated, modularized starting point that works well with a CSS framework of your choosing (UIkit3, Bootstrap5, Tailwind, CodyFrame or no CSS framework). Whichever CSS framework one uses, a page builder (ie, the 'Blocks' field), would be provided that's built around the chosen CSS framework. UIkit3 would be the most flexible in page building capability (since UIkit is designed for page building scenarios and it's easy to replicate the logic and thought process of how YOOtheme did their builder), but the page builders for others would work well too as they would be inspired by YOOtheme's approach but just adapted for the respective CSS framework. I'm taking great care to make it as easy to use as possible. A goal of this is to make ProcessWire easy to use for those who are just starting to use it and not sure how to structure things. This is where the heavily opinionated decisions I made come in.
    1 point
  20. I'd probably do so but my CSS is most of the time optimized and therefor small enough. However you decide now I could imagine someone asking for the exact opposite. So why not both options and the developer can decide in the module settings how to handle those files. There might be a small delay but nothing to worry about - I guess. How many files are needed to boot up ProcessWire? The server already reads a ton of files. But sure... things like WireCache or ProCache would be a good option here. You could throw a whole bunch of framework CSS at your testing page and add UIKIT and Bootstrap CSS and maybe some more files just to test to the extreme. However we think about solutions, problems, and/or use cases for your module... there will be a few that use it totally different and will probably challenge everything. Maybe go first with your preferred or the fastest way, add other options later based on requests and ideas from users.
    1 point
  21. Try to look into RockMigrations. It is great and makes updating fields and templates easy and version controllable.
    1 point
  22. There have been plenty of discussions and ideas about this very exact topic. Right now... manual field, template and page exports could be a way to go - I don't really like it but it works most of the time. RepeaterMatrix and some other fields are complicated or just can't be moved that way. You have to ship around some obstacles here and there. Maybe just give it a try. Then another viable option could be RockMigrations. It has kind of a steep learning curve but might be the swiss (or austrian in this case) army knife for migrations.
    1 point
  23. From the PW side the install option is missing) I've created one for my own purposes and happy to share with the community: https://bitbucket.org/valieand/pw Someone who has more time and competence can fork and polish it in order to add to official install options.
    1 point
  24. Would love to have this: From https://github.com/ryancramerdesign/ProcessWire/issues/1619 Referenced by this post: Icing on the cake might be:
    1 point
  25. The easiest and best way to setup this stack in my opinion is ddev. DDEV is an open source tool that makes it dead simple to get local PHP development environments up and running within minutes. It's powerful and flexible as a result of its per-project environment configurations, which can be extended, version controlled, and shared. In short, DDEV aims to allow development teams to use Docker in their workflow without the complexities of bespoke configuration. Me and @bernhard use it, and are very satisfied. I am using it on Windows 11 inside of WSL2. But it also runs on Macs and Linux machines.
    1 point
  26. http://devilbox.org/ https://devilbox.readthedocs.io/en/latest/examples/setup-processwire.html Update Now I recommend ddev too
    1 point
  27. awesome! Thanks for using the module - hope it helps and is useful!
    1 point
  28. Thanks I will look into this and if it works I will update this post ? Update: Approach works ? $this->addHookAfter('ProCache::allowCacheForPage', function (HookEvent $event) { $event->return = (!empty(\DROPLET_HOSTNAME) && (\DROPLET_HOSTNAME === "my-droplet-production-01" || \DROPLET_HOSTNAME === "my-droplet-stage-01")) ? true : false; });
    1 point
  29. @OllieMackJames I've experimented with most of the popular page builders in WordPress, including Oxygen. The direction I'm taking is vastly different from all of them. Simply put, the page builder being based on RepeaterMatrix is what I'm trying to accomplish and for it to be usable with the developers CSS framework of choice (Uikit, Tailwind, Bootstrap, Codyframe, no framework, etc.). Anything beyond that is outside my skillset and the scope of what I'm truing to do. I have no interest in using React, Vue, etc. and going to the extreme like the WP page builders do. The page builder will simply be "good enough" to make marketing pages based on the capabilities of whatever CSS framework is installed.
    1 point
  30. This can now be done with owner selectors (http://processwire.com/blog/posts/processwire-3.0.95-core-updates/) $tagsThatHaveBeenUsedOnPosts = $pages->find('template=tag, tags.owner.template=post'); Where tags is the name of the field on the post template that holds the tag pages. Also, for any given tag page you can check how many post pages reference it with $page->references('template=post')->count(); https://processwire.com/blog/posts/processwire-3.0.107-core-updates/#what-pages-point-to-this-one
    1 point
  31. @Macrura Thanks for pointing this out. I couldn't find a documentation, about toolbar items available within processwire. I tried all of the CKEditor fullpackage and all items are usable. Here a complete list: Source, Save,NewPage, Preview, Print, Templates Cut, Copy, Paste, PasteText, PasteFromWord, -, Undo, Redo Find, Replace, -, SelectAll, -, Scayt Form, Checkbox, Radio, TextField, Textarea, Select, Button, ImageButton, HiddenField Bold, Italic, Underline, Strike, Subscript, Superscript, -, RemoveFormat NumberedList, BulletedList, -, Outdent, Indent, -, Blockquote, CreateDiv, -, JustifyLeft, JustifyCenter, JustifyRight, JustifyBlock, -, BidiLtr, BidiRtl, Language Link, Unlink, Anchor Image, Flash, Table, HorizontalRule, Smiley, SpecialChar, PageBreak, Iframe Styles, Format, Font, FontSize TextColor, BGColor Maximize, ShowBlocks About
    1 point
  32. actually this is in the core, all you need to do is add these to your toolbar (you don't need to add any plugins): so where your first line would look like this out of the box: Format, Bold, Italic, -, RemoveFormat you can change it to be like this: Format, Bold, Italic, Underline, -, RemoveFormat, -, TextColor, BGColor
    1 point
  33. how would one output an optgroup in an options field, if it is somehow possible? ran into this today...
    1 point
×
×
  • Create New...