Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/19/2025 in all areas

  1. Simply having a manifest file (and referring to it in the HTML) causes it. Ironically, if you don't have one, a lot of website checkers/validators complain when you don't have one, presumably due to some people creating/dragging website shortcuts to their desktop to create a shortcut and not having a predefined way to direct how it (the icon/shortcut) should be presented.
    1 point
  2. @poljpocket "It's not in the app so it shouldn't be in the app" isn't really a good argument against anything in software. Because it's a feature that would be beneficial to module developers and future utility. I think that's the point here- is the case being made for utility. I can see situations where this would be useful in the future and I don't have a reliable way to create dependencies that would make building on top of this functionality easy for me or users. Let's call my argument entirely separate from @bernhard as a developer who would love to see this supported without a complex module requirement process that doesn't exist and would require a lot more work to implement. If/when the time comes that something would benefit from adding hooks to the module, then it would be a good time to do it. There is no need to go and edit all of the JS for each module just to make it immediately available. It is perfectly fine to say that "many existing modules do not yet support JS hooks, but they may in the future". But the InputfieldDatetime.js example is probably a good example of where one may be easier to convert, at some point down the line (if it ever needed it), since it is a relatively simple JS file with few methods and not many lines of code at all. An alternative way of looking at this is that should the next version of a Datetime picker be chosen to replace this one in the core, for any number of reasons, then that would be a good time to write it for the first time. If a third party module for an alternate Datetime picker was to be written, it could make use of JS hooks if it's useful or valuable. All that aside, here's something that may resonate with the wider PW developer community. The server side API for ProcessWire is wildly powerful and flexible, however the client side is an area that has a lot of opportunities for growth. It doesn't have the dynamic nature of more modern front-ends. ProcessWire is built on jQuery and one of the things that @bernhard mentions were events. jQuery event listeners do respond to vanilla JS dispatched events and vanilla JS events can't be heard by jQuery. This can create interoperability issues for modules that primarily use vanilla JS and modules/core that strictly use jQuery. This bit me in the last couple of months. Hooks are an opportunity to bridge that gap, in the future. I need to stress this point- nobody expects the entire core to support this immediately or asking for it to. ProcessWire does not use event-driven architecture, it uses hooks to provide similar functionality. JS hooks are an opportunity to provide some sort of parity and additional powers on the front end that could translate somewhat into "if you know server-side ProcessWire hooks, you'll be comfortable using client-side hooks". One of the things that is really difficult for me to work around is not having a more dynamic UI in the admin. Having core and third party modules JS call hooks on specific events would make this much, much easier without having to write a lot of code or build an entirely new select input module. This is the first step towards an overarching client side admin API, which doesn't currently exist. Here's my hot take- jQuery is popular and easy to use but it will become a legacy library and in many ways it already is. I haven't used jQuery in projects in many, many years and the most recent lines I had to write were adding duplicate events fired in jQuery that I was already dispatching in vanilla JS in a module to make the rest of the UI see changes to fields. There are a lot of devs who really don't want to write jQuery. In 2025 it isn't necessary for jQuery to exist other than existing dependency or personal syntactical preference. There are going to be an increasing amount of people who want to use ProcessWire that have never written one line of jQuery. Does anyone expect the core to fully support hooks in all modules now? Tomorrow? Next week? Not at all. But having a framework in place that allows the core to continue using jQuery without overhauling it to bring a lot of extended functionality is really valuable. Nobody is asking that ProcessWire be rewritten in Alpine or htmx or something, hooks are a consideration for introducing more powerful features in the style of ProcessWire as part of a roadmap. Here are my questions @poljpocket: What is the best way to introduce new client side powers without completely overhauling the core JavaScript? Why is introducing powerful utilities that developers can use as part of ProcessWire being a framework, with parity in approach between server/client apis, that it may not prioritize using itself bad? If hooks can be introduced incrementally as needed, "as convenient", or by contributions and PRs- is that really completely overhauling the core JS? It seems like you are shooting down the simple examples, which are simple to show how easy using them can be, but haven't made the case for a true net negative other than saying "it will require work". This isn't how frameworks work, but it also doesn't preclude the value of having it available for use by the core in the future.
    1 point
  3. Thanks! This works great. I added a "sticky" checkbox to my categories page and now it stays at the top. 🤩
    1 point
  4. $wire->addHookBefore('ProcessPageList::execute', function ($event) { $event->object->addHookAfter("find", function ($e) { $selector = $e->arguments(0); $page = $e->arguments(1); if ($page->template == "blog") { $selector = new Selectors($selector); $selector->add(new SelectorEqual('sort', '-sticky')); $selector->add(new SelectorEqual('sort', $page->sortfield())); $result = $page->children($selector); $e->return = $result; } }); }); I think this is it, I remember the other caveat now, that "-sticky" is a checkbox field added to the pages I want on top. Also not super sure the nested hook is required, maybe just hook before/after "ProcessPageList::find".
    1 point
  5. Quick shoutout and thanks to @bernhard for both RockCalendar and RockJavaScriptHooks. Modifying the module UI to fit client preferences was one line in some JS added to the admin. It really opens up a lot of opportunities for making module JS as flexible and powerful as ProcessWire. Nice work 🙌 I came to post this randomly and didn't know about the ongoing conversation. Might have been good timing. @ErikMH Here is an example on site I'm working on. By default, RockCalendar times are 24hr, this hooks into the JavaScript method that creates the timepicker and changes it to 12hr time. JS hooks are supported in RockCalendar. // Set calendar time input to 12 hour ProcessWire.addHookAfter('RockCalendarPicker::settings', e => e.return.timePicker24Hour = false); Without this ability my alternative is to modify the module where it would break later or request a feature. "Can you add a config option for 12hr time" is a feature request I didn't have to write and @bernhard didn't have to read/implement and his module has even more utility right off the shelf. In cases where you're working on an open source/free module that can be a really big deal as well. Just to contribute a little more to the greater conversation- there is a lot of value in this. I would go as far to say "it will become clear how useful it is when you really need it." Hypotheticals for hooks are difficult. Most of the hooks in PW core are just "neat" until the time comes when they solve an issue or let you do something really cool. This would be more true if there were true dependency support in the core the way that it exists in Composer. Until then the requirement of dependencies is difficult to put on the user unless they come from the same author or are somehow packaged together in a way that handles that more easily. This is especially true since there is segmentation by module type (Inputfield, Fieldtype, Process, Markup, etc) and manually installing these one b one becomes exponentially tedious. If dependency installation existed then there could be fewer feature requests for Ryan or core contributors and that development can remain focused on the "framework" part of ProcessWire rather than individual unrelated feature requests. Perhaps this would be a good feature request for the core. In this case, JS hooks are a natural application of a fundamental feature on the client side implemented in a syntactically consistent way which encourages adoption and potential utility in the same. That would be my argument for core over module. Core support for the ability to hook into JS scripts can be established beforehand so that modules can take advantage of it and the core can implement gradually. It is an enhancement, not a breaking change, and doesn't modify the core API. A rollout where updates are prioritized by the greatest utility when feasible is an acceptable path forward IMHO. If hooks were part of the core I would write them into modules I build. The value of doing that is future creativity and problem solving by developers who use them.
    1 point
  6. The browser does that because you have a manifest file which means it is a PWA that is installable and therefore the browser shows the install prompt (https://processwire.com/site/favicon/site.webmanifest), see here: https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/How_to/Trigger_install_prompt
    1 point
  7. ProcessWire can never be WordPress with its famous fast install, precisely because of ProcessWire's flexibility. The appeal has to be to developers, or designers who know a little code, but don't want to have to get stuck into learning a lot of code. I think with more site profiles, using popular CSS frameworks to enable easy customisation, ProcessWire could maybe grab some of those WordPress users, as the installation process is quick and easy, it's just the customisation that takes time, and if there's a profile that meets your needs, it's as quick to get a site up as WordPress. It's when you need anything else WordPress is horrible. Maybe there needs to be an option for paid site profiles? One of the issues with profiles is that they're applicable at install time only, but via something like RockMigrations it would be possible to have a profile like a blog profile, but then multiple migration files that can theme the same data differently. I wonder whether rather than calling things site profiles, calling them ProcessWire apps might better convey what they are - or not? I think the key message I'd be wanting conveyed to other developers and potential clients is 'build anything - fast'. Much as I dislike Wordpress, it's claim to fame, 'build a blog - fast' it actually can deliver on pretty well. It's when you try to build anything else with it that it starts getting horrible. Incidentally, I just took a look at wordpress.org, and if I didn't know any better, visually comparing that to ProcessWire, I'd choose WordPress. It starts off quickly summarising what it does, then with a bit of scrolling gives a bunch of screenshots of the diversity of things people have build with it. The only call to action on the ProccessWire site is 'download', and mostly impersonal, whereas wordpress.org is full of personal calls to action: 'Get', 'Meet', 'Discover', 'Explore' ... The site uses some similar large fonts and a lot of visuals, but the above the fold content gets to the point quickly. The big stuff comes after scrolling. Since I'm being critical, I'm happy to write something and send it through for evaluation, as I have benefited from the ProcessWire community. I'm not a designer, or probably even really a marketer, but I I do have a bit of interest in language, and I think the text could be significantly improved to be more compelling. Here are a couple of examples of how I'd rewrite things: Save time and work your way with ProcessWire, a free content management system (CMS) and framework (CMF). Enjoy all custom fields, a secure foundation, proven scalability and performance. Take control over the design You can define and edit all fields in ProcessWire easily in the admin. You can create as many of them as you want, and of any type. You can even bundle them in repeatable groups called Repeater fields. You control all of the markup, not ProcessWire. If I want to sell end users on ProcessWire I want to show them it can be as pretty as WordPress and more capable. Luckily here in NZ I can just refer them to the portfolio site of @Robin S as he's done a number of high profile sites that are well known nationwide, and I can say 'built using the same system', and also reassure them that I'm not the only ProcessWire developer out there. (It helps that I'm a regular visitor to several of the sites he's built too.)
    1 point
  8. ProcessWire has always communicated well to developers and they typically aren't the ones that need to be convinced. We always connect with the developers. But the decision makers are more often the clients, designers, marketers, etc. They are the ones that we hope to increase visibility to. Several updates to the new site this week, various minor optimizations and improvements. The biggest additions were made in the API reference, which now covers a lot more methods and has some navigation improvements as well.
    1 point
  9. Here we go!!! https://github.com/processwire/processwire/pull/322 Fingers crossed 🤞🚀😍
    1 point
  10. Hi @ryangorley! Not sure if you've taken at this old but still very relevant post: I'd say the best way is the one that fits your use case and in that sense ProcessWire has no rules about categorization. The tags can exist under their own parent separate from the "News > Blog Item 1" tree branch: /tags/tag-1 And be linked through the tags inputfield, it's pretty much the same case for categories. To my own personal taste I always tend to go with an structure like this: - ? News -- ? Tags ---- ? Tag 1 ---- ? Tag 2 -- ? Categories ---- ? Category 1 ---- ? Category 2 -- ? News Item 1 -- ? News Item 2 I like this because it keeps everything in the context of the "News" for the editors, and also the following URL structures which makes sense to me (not so sure about SEO but have had no complaints lol): /news/tags/tag-1 /news/categories/category-1 /news/news-item-1 The only part I'm not a huge fan of is that it requires a bit of code using hooks to keep the right sort underneath the "News" page, since the actual news items share a parent with the tag/categories parent, sorting the News children by published reversed, will (most likely) send the Tags and Categories to the bottom. But it ain't that big of a deal and if the problem arises to you I'll gladly share my solution. Also, to my own taste, I use a custom field for publish date, this lets me have more control over it and handle the visibility of the actual post with the hidden/unpublished status depending on what I want to achieve. Now for archive pages i'd suggest you take a look at what @ryan did in this old but also still relevant blog profile: https://github.com/ryancramerdesign/BlogProfile/blob/master/site-blog/templates/archives.php In all fairness this is not the clearest example and it's one of those part you'd expect to be built by default in a CMS, but I always think these details are worth the effort as a sacrifice for the flexibility PW gives you in terms of data structure/relation.
    1 point
×
×
  • Create New...