Jump to content

teppo

PW-Moderators
  • Posts

    3,260
  • Joined

  • Last visited

  • Days Won

    112

Everything posted by teppo

  1. Without going into too much detail regarding the previous discussion here, I've just heard of https://gutenbergcloud.org/ for the first time, and I've got to say that it seems promising. The basic idea is to provide a common service for installing all sorts of blocks – and only the blocks you actually need. (Currently the situation is roughly that some blocks are shipped as one-block plugins, while others ship as massive collections of blocks, neither of which are really optimal.) Also took a quick dive into Gutenberg for Drupal (which Gutenberg Cloud promotes), and they've done a smashing job there ? I'm definitely interested in looking into setting up a Gutenberg Fieldtype, or perhaps a Process module – or something similar. Though once again my desk is kind of full, so who knows. -- Although I did say that I wouldn't go into the earlier discussion, just a quick comment on that: As a tool Gutenberg has it's flaws, and it's definitely not a tool that would/could/should somehow replace what ProcessWire does. I don't think that anyone has been suggesting that here either. Gutenberg is a block builder, and admittedly one still in a relatively early state – but even at this stage it looks promising. There really aren't any serious contenders, particularly fully free and open source. Right now there's also a lot of momentum behind the project – not to mention financial backing from Automattic – which means that as a tool it will undoubtedly improve over time, and current issues will eventually get ironed out. Whether going with Gutenberg is a good thing for WordPress or not is a debate I don't want to get into. Personally I don't know anyone seriously developing sites with WordPress and not using either one of the existing block / page builder solutions, or some sort of ACF based approach. WordPress alone is not the point – the plugins are. Since block editors are probably the most popular way of building WordPress sites, in my opinion having one built into the core is a logical next step. But that's just my opinion. And again, it has little to do with ProcessWire ?
  2. Cross-linking this here, ping @ryan:
  3. Please note that the Modules/Plugins area of the forum is intended for module-specific support threads only. General questions and module requests should go to other areas instead. I'm moving this thread to the "Getting Started" area.
  4. That error is a generic PHP error message, so making sense of it requires some basic PHP debugging skills. There's no manual here – just read the message, see what it is related to, and try to figure it out from there. Google is your best friend when debugging PHP code ? The message here is rather clear: In other words you're trying to call function and() on a null value in your _main.php file, line 49. The exact reason is impossible to say without seeing the code, but my guess so far would be that you're grabbing a page or something like that, and not actually checking that it has a valid value before trying to use it as an object.
  5. Your hook method isn't doing any caching, so every time it's executed, it makes a request to the API. In your head.inc file above you're checking if shopifyShopCurrency is already stored in session – but if it isn't, you're making two separate requests to the API: if ($page->ipapiGetUserLocation()['currency']['code'] && $page->ipapiGetUserLocation()['currency']['code'] !== 'GBP') { So, it seems to me that simply by grabbing $page->ipapiGetUserLocation() to a variable and using that for those checks you could probably cut your requests for new users to half. } elseif (!$session->get("shopifyShopCurrency")) { // Set it as the Shopify store default Just for the record, this row is kind of odd, since there's no chance that $session->get("shopifyShopCurrency") would be set by now. Although it should work, it's unnecessarily verbose and does kind of a pointless request to $session – a simple "} else {" would've been enough. It's probably unrelated, but it's also a bit strange that you're querying the currency code based on user location, but you're never actually using it. I'm assuming that this is by design, but it's still kind of curious ?
  6. Apparently "instanceof" doesn't allow constants, strings, or expressions, while is_a() happily accepts all of those. This is news to me, and I'm not entirely sure of the behind the scenes logic, but it probably has something to do with instanceof being a language construct (those sometimes behave a little bit unexpectedly) – or it might simply be a performance optimization. After all instanceof is much better in terms of performance than is_a(). Use variables or literal class names instead – or if you really have to, use the workaround provided by @tpr above, i.e. store the constant value to a variable before use ?
  7. Probably worth pointing out that currently the "safe thing to do" is going with 7.1 or 7.2: 7.0 is no longer officially supported, so it's no longer receiving security updates, and even 7.1 will stop receiving (security) updates near the end of this year. 7.3 is currently the "cutting edge" version, so you might want to wait a while before going there. In terms of security there are exceptions, such as Ubuntu, where distro maintainers have been backporting security-related fixes from new versions to old ones – but if you're already on 7.0, I would assume that it's not the one that you got with your operating system, and as such is likely that you're already using a (potentially) insecure version.
  8. I'm biased, and probably not the biggest user of Tracy either, but in my opinion support for PHP < 7.1 should be safe to drop by now. For the folks stuck with those versions, current Tracy version still works – right? That's what I've been doing with my modules and code recently: splitting a separate "legacy" branch for those who need it, but only focusing new development for current PHP versions. And by "current" I mean the officially supported ones.
  9. Actually I would recommend posting this as a GitHub issue. It's not really a "problem" per se, but I also don't see any point in storing all those decimals, so they're just unnecessary clutter. Hard to say if Ryan will consider it worth acting on though ?
  10. Well, it might be technically possible, but there's no core support for it, and I wouldn't recommend it ? In this case you would probably have to modify index.php, .htaccess, and at least some other core files: wire/core/ProcessWire.php, wire/modules/Process/ProcessLogin/ProcessLogin.module, and wire/modules/Process/ProcessPageView.module. Modifying core files is never a good idea, as it makes updating ProcessWire difficult (usually you can just replace certain core files and that's it), and there's also no guarantee that some third party module etc. isn't expecting the core to remain as-is. So, long story short: if you really have to, you can of course modify it, but there's no guarantee that things will work as expected afterwards. If possible, I'd recommend developing the ProcessWire site elsewhere (subdirectory, or another domain, or locally) and then replacing the old site in one go. ?
  11. Hey @adrian. Just wondering if this thread might've served it's purpose already, or do we still want to keep it pinned to the Modules/Plugins area? I'd say that it's been long enough, but it's your call ?
  12. Moderator note: the "Modules/Plugins" forum section of the support forum is intended for module-specific support threads only, so I've moved this thread to the "General Support" section instead.
  13. Quick update: version 2.0.0 of this module is now available via GitHub. This version includes updated RedBeanPHP library, various new config settings (including the ability to disable automatic setup of RedBeanPHP, and an option for choosing one of the trimmed down library versions with support for specific database type only), and various other updates to the module. I've also dropped support for PW 2.x and PHP < 5.4, and updated module requirements accordingly. For pre-3.x or pre-PHP 5.4 users the legacy branch still contains old version of the module.
  14. Hey @ryan. I'm wondering if it would be possible to set up a repository for the new site, so that we could submit pull requests and report issues there? Personally I'd still like to suggest some usability / accessibility related changes and fixes, but currently that's a bit difficult to do – and it basically requires me reporting the issue, and then you having to figure out how to fix it for the site. If there was a repository, we could a) reliably keep track of issues that have been fixed or closed for other reasons (avoiding duplicate reports), b) submit changes so that you don't have to do everything yourself, and c) experiment with the site with ease. If the site has features that can't be made public, a repository containing partial site profile would of course do, but the best solution would imho be a full site that we can install locally, makes changes to, build, test for regressions, and so on. Or perhaps you could only share access on a case-by-case basis, since even GitHub now supports private repositories? ? Thanks for considering this!
  15. I'm probably a well-known nay-sayer around here already, but I'm still going to add my +1 to this discussion. I feel that (particularly when it comes to API design) one clean and consistent solution should be preferred, unless an alternative approach provides major benefits. Multiple options only tend to make things more fragmented and more difficult to grasp, and doubly so when you're a new user. As such, I'm always thrilled when an update enhances the core somehow (performance, security, scalability) or makes something new possible or more streamlined (in this update valid() and validate(), plus the whitelist feature) ... but I cringe a bit when a new way of doing the same old without (seemingly) notable benefits is added. Personally I wouldn't mind seeing the core get leaner in the future, perhaps in 4.x. There are, and always will be, features that should be added to the core (shameless plug: FiedltypeDecimal), but on the other hand alternatives without major benefits or major user base, and modules that may not be particularly often-used should, in my opinion, be stripped out. A module I've been working on recently has an "alias" feature (that isn't even that important to the module, to tell the truth), which was getting way out of hand. You could provide its arguments in five different formats, at least, which all required their own handler methods. I was working on this feature on Sunday (once again), and finally got fed up with it, stripped all those alternatives out and replaced them with one unified solution: callbacks. Sure, a bit of syntactic sugar might've been lost in the process, but I also got rid of probably 75% of the required code, and the documentation page is now actually readable. So, yeah – I know exactly what you're talking about ?
  16. Hi @Guy Verville. I took a quick look at TemplateEngineFactory.module.php, and this is what I've found out so far: Preview feature is essentially a couple of lines of code in ProcessVersionControl.module. Since we're doing this in an execute method of a Process module, current page is under admin area, and has template "admin". Before we even get to the preview method, autoload modules have already run their course. TemplateEngineFactory initiates itself in a ready() method, and bails out early if current template is "admin", which means that its features won't be available for us. Without modifying TemplateEngineFactory itself, I currently see two options: reworking the preview feature to do something else (though not quite sure what.. perhaps it could define a custom template or something like that), or trying to overwrite current page (to fix the $this->wire('page') reference in TemplateEngineFactory.module.) Latter option sounds more feasible, yet I'd have to test this properly to make sure. I don't have a proper setup for that available right now, but I'll see if I can get to that sometime soon. That being said, if you could provide me a stripped down site profile to test this with, that'd make things easier for me ?
  17. That's a nice find, and I believe that a tool like this would indeed be a nice addition for users that don't generally require a screen reader. That being said, those who do require such assistive technology will already most likely have their own individual setups, and a separate tool won't really help – so the accessibility argument is somewhat questionable. Perhaps even misguided, since it may give some folks an impression that this is enough to take care of all screen reader related accessibility needs. Accessibility, particularly referring to screen reader users, is not just about enabling "text-to-speech voice for the relevant content" (at least the way I understand their selling point), but rather about making sure that the entire user experience takes screen reader users into account. In other words: providing a read-out-loud button for the main content is not enough, if some users can't even navigate the site with ease ?
  18. Hey @J_Szwarga! Is this related to the FormBuilder module? If so, you should really be asking this on the VIP support area. If you've bought FormBuilder, you should have access there – and if not, you should contact @ryan. I don't have an answer to your question, but perhaps someone else will be able to chime in, here or on the VIP support area. Note: the "Modules/Plugins" area of the forum is for dedicated module support threads only, so I'm moving this post to the "General Support" area of the forum.
  19. teppo

    TDD in PW

    Please be a bit more specific. Why is this so important to you, and how would you envision it being implemented in the context of ProcessWire? Have you considered the possible solutions mentioned in this thread, and if so, what made you decide that they are not good enough? We're always happy to discuss new ideas and suggestions, but on the off chance that you're only posting these things in order to cause an argument, be aware that such behaviour won't be tolerated here. Thanks for giving your posts a bit more consideration from now on, and have a great day!
  20. About verbosity: I don't find it inherently bad either. Don't get me wrong – I truly enjoyed reading this post. There's always room for such text, and I love the way Ryan explains things. It just makes sense. That being said: if and when someone is only just trying to figure out how the API works – say, they're evaluating a number of platforms, and want to see which one makes most sense – it would be best for both us and them to have a short version available. Key points only: what are the methods they can use to access the API, where and why they should use each method, and finally "read more" -links for more details about each method. I've been digging into a lot of new tools recently, and I can say from experience that it makes worlds of difference for a newcomer how fast and easy they can get the basics in. It's the worst if you have to spend loads of time digging into terminology, long posts discussing philosophy and behind-the-scenes implementation, or other things that don't really matter at that point, just to know if this actually is the platform you want to invest your time in. It should be an incremental process: start from the basics in an easy-to-chew package, and continue building up from there. You don't want to drop a mountain of information onto a newcomer on one go ?
  21. The first bullet point seemed to answer my question from the previous thread: module's can't add features to the Functions API, it's immutable in that regard. The second bullet point, on the other hand, seems to contradict the first one: module developers can indeed create new functions for API variables, effectively adding to the Functions API – even if behind the scenes the implementation isn't identical. It might be worthwhile clarifying the wording here a bit, I at least found this part confusing. Leaving the "it's a very specific list of functions that doesn't change" part out and perhaps adding "By default" before "Only those that are likely" would be an improvement – unless I'm misunderstanding the whole thing? Also, a table of contents would be really nice for these longer pages. --- Overall I think it's great that there's now documentation for a lot of stuff that was completely missing before. I do agree with @adrian in that the new documentation is a bit verbose, though. It's a lot to browse if I simply want to get the facts. My own writing style tends to be extremely verbose, so I should know ? @ryan, would be possible to allow others to somehow make suggestions to the content of the site (and particularly docs) without having to open a new issue for every suggestion? It'd be amazing if we could somehow make some kind of change suggestions and submit them directly via the site, perhaps publicly – or at least for a limited group of volunteer editors. Trust me, I do realise that keeping everything up to date, managing the core, writing weekly posts, and whatnot must be an unbelievably time-consuming job. Just looking for ways the community could perhaps participate.
  22. @rastographics, it looks like you're missing a semicolon (";") at the end of the line starting with "$f->description". Or was the screenshot cut off early? ?
  23. Yes and no: the page those forms are rendered from isn't actually in the admin area. By default it's a regular page at /form-builder/. This page has a template file of its own, and when you access said page, it figures out the correct form and renders it – making use of some stuff bundled with the core for rendering the form and form fields. Technically you can do that with any module that produces output: just figure out when and where to render it, call a method that returns output, make sure that necessary styles and scripts are loaded, and output the... err, output. If you need to do something based on user actions, implement necessary endpoints with hooks, URL segments, or based on POST/GET data. I'm using something similar in ProcessChangelog for rendering the RSS feed generated by a Process module for front-end users: https://github.com/teppokoivula/ProcessChangelog/blob/master/ProcessChangelogRSS.module#L97:L103. ... but that's a really, really simplified version of it, and perhaps not quite what you're looking for yet. ? AdminBar makes use of the ?modal=1 parameter that Admin supports, in which case header/footer areas are left out of the response. I've used this method for injecting things like profile edit screens into the front-end for registered and logged-in users – though they tend to look a bit off in an iframe, so usually I use an actual modal instead – but it doesn't yet solve the permission issue. ProcessWire's permission system is relatively flexible, but as @bernhard already pointed out, there are always risks involved when you tweak such things ? Not trying to speak for Bernhard, but I believe the idea was to utilise the module architecture, probably Process modules in particular, to easily create front-end-oriented tools, so not really free-for-all editing per se. A booking system might be a good example – you may want to give guests a limited access to create new content or perhaps even edit/delete content based on specific set of rules, but this could also be useful for creating non-editable views. Front-end listers, anyone? ? --- I think that overall this idea has some potential. Not sure to what extent, or how feasible this would be, but it might be worthwhile creating a small proof-of-concept and trying things out. The permission thing is still a huge question mark, though. If I was to build something like this, I'd probably start by looking what ProcessController core class is doing, and how it's used by the Admin itself. Though correct me if I got the whole concept wrong, and this is actually about something different entirely. There may be other ways to use the module system in the front-end as well, but Process modules are basically what the Admin side is made of, so when you say "public backend pages" – well, that's what it sounds like to me ?
  24. Literally days before this announcement I needed a private repository for a new project, and registered a Bitbucket account for that. Haven't migrated back yet, but probably will ? GitHub provides free private repositories for max 3 collaborators, while Bitbucket has a limit of 5 collaborators for a free private repository. Not a huge difference... unless, of course, you're running a team of 4-5 developers and want to save a few bucks ?
  25. By the way, I was just wondering what might be the recommended alternative to defining custom API variables (particularly by modules) for the Functions API? Is there one? I for one have found these very useful, as they provide a way for module authors to add developer features that feel consistent with the "native" API. In case custom API variables are only feasible with the non-Functions API, then perhaps that should be documented as well; or am I just overthinking this? ?
×
×
  • Create New...