Jump to content

Robin S

Members
  • Posts

    4,928
  • Joined

  • Days Won

    321

Everything posted by Robin S

  1. This sounds interesting but I'm not quite getting it. Could you give some examples of what kinds of scenarios this would be useful in? I thought the PagePathHistory module took care of everything automatically so you never need to think about manually creating or editing redirects. Or does this module allow you to also create redirects when there never was a page at a particular URL? e.g. /some-path-where-there-never-was-a-page/ => /some-page-that-exists/
  2. Based on that thumbnail URL I'd be looking closely at ProDrafts. You could try a clean installation with only ProDrafts added and see if the fieldset issue is reproducible.
  3. I think I have things set up the same as you and it's working... Repeater fields (title visibility is set to "hidden"): Hook: $wire->addHookAfter('Pages::saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'repeater_test_repeater') { $title = 'No pages selected'; if($page->test_page->count) $title = $page->test_page->implode(', ', 'title'); $page->title = $title; } }); Result: Tracy Debugger will be helpful in debugging what is going inside your hook.
  4. Looking around, it seems that getting/saving/loading the table metadata like merged cells and comments is not well supported/documented in Handsontable. And I think the merge cells plugin is undergoing an overhaul currently. There are a few hacky examples out there and when I get around to it I'll see what I can come up with and report back. But for my current project I have decided to go with a different solution for tables (tables in CKEditor plus some jQuery manipulation is proving adequate... barely ).
  5. This is an issue with the Process Batcher module so you might want to raise it with the module author over in the support thread. If you're using Batcher in PW3 you'll need my PW3-compatible fork until the pull request is merged.
  6. The first hook in your post works as expected for me - it sets the title field inside the repeater item (assuming there is a title field included in your repeater). But the last hook in your post looks like maybe you are instead trying to do something different - like you have a one "variations" repeater nested inside another "variations" repeater and you are concatenating the titles of the nested repeater to the parent repeater title. Incidentally, you should add a template check in that hook or you will get a PHP error for invalid foreach argument on any page that doesn't include the variations field. Can you explain some more about what the objective is?
  7. You'd think so, but test it and I think you'll find that assets added in renderReady() are always loaded when the inputfield may appear in Page Edit, even if AJAX-loaded. So for example, you can put an inputfield with a JS dependency such as PageAutocomplete in a repeater, and put that repeater inside another repeater (so the PageAutocomplete inputfield is definitely not being rendered initially) and you'll find that the PageAutocomplete JS dependency is included in Page Edit. PW seems to be smart like that.
  8. I believe this is what Inputfield::renderReady() is for: adding dependencies to $config->scripts and $config->styles, and also adding JS objects to ProcessWire.config via $config->js(). But I think all this is not well understood by module developers, myself included. Would be great to get a tutorial some time, maybe in a weekly blog post @ryan?
  9. Hi @bernhard, Do you think it would be possible to support merged cells in FieldtypeHandsontable? Merging cells is a feature in Handonstable, but the merged status (i.e. colspan/rowspan) is lost when the field is saved and reloaded. I guess there would also need to be some way of determining if a cell is merged when getting it via the API.
  10. Is there a way to add a filter based on template flags in Lister (or Lister Pro)? I want to exclude pages that use a system template because I don't want to see repeater pages and I'd rather not have to come back and exclude specific repeater templates as new fields are added. Seems like this should be possible but I can't see a filter option for it. Also, I thought it was possible to type in a custom filter to Lister. Or is that only supported in the standalone InputfieldSelector? Edit: okay, I could just exclude the "Repeaters" or better yet "Admin" parent page in has_parent, but the question stands: it it not possible to filter by properties of a template?
  11. This might be because the "complexify factor" is something internal to the JS library used in InputfieldPassword - perhaps difficult or too time-consuming to port to PHP. I'm putting together a little module that adds a "Generate password" button to InputfieldPassword and from my testing it seems you can probably ignore the complexify setting in your EmailNewUser module because when set to the advised range of 0.5 - 1.0 then any randomly generated password seems to satisfy the complexify setting. Incidentally, I'm not a fan of vague settings like "complexify" because it's totally meaningless to the user who is setting the password. Imagine getting feedback like "Sorry, your password is 0.1 units not complexified enough." The inputfield currently says "too common" when failing the complexify setting but that's not really accurate because a random string can fail a high complexify setting. Settings like this can make for infuriating UX. I noticed that and found it very strange. It must be deliberate because the method comment says: But surely if you are setting a max length you want a max length for the whole password? Can't think why Ryan would have designed it that way. I have put in a feature request on GitHub.
  12. You're absolutely right - I thought the links were opened with Javascript and that therefore I couldn't control the target tab, but I was getting them mixed up with the parent class link which just toggles the list of class methods open and closed. So all good, thanks.
  13. @fbg13, thanks, that might have been what I was remembering. I found a better method in the same class: randomPass(). It gives you a lot more control over the generated password and avoids similar characters like I/1 and O/0. I still think it would be handy to have something that can pull settings from a given FieldtypePassword field though. And a "Generate password" button in the inputfield would be cool too.
  14. @tpr, just following up a request from a while back. I think this is similar to the issue @szabesz raised the other day - it affects both the core Lister and Lister Pro. I'd like to keep the Lister tweaks active in AOS because the "Show action buttons on hover" is handy but I'd like to have a way to turn off the fixed selection of columns. I think if the columns AsmSelect is empty for a Lister then AOS should take that as meaning "do nothing to this Lister's columns".
  15. Is there some API method to generate a random password that satisfies the settings of a given FieldtypePassword field? Something like: // Pseudocode $f = $fields->get('pass'); $random_pass = $f->generatePass(); I feel like I've seen something like this somewhere but maybe that's just wishful thinking. At the moment I'm doing this for random passwords (picked up somewhere in the forums here)... // Generate a random, temporary password $pass = ''; $chars = 'abcdefghjkmnopqrstuvwxyz23456789!@#$%&*'; $length = mt_rand(9,12); // password between 9 and 12 characters for($n = 0; $n < $length; $n++) $pass .= $chars[mt_rand(0, strlen($chars)-1)]; ...but is there a better way that takes into account the settings of a password field?
  16. Suppose you have an images field and you want editors to upload a specific number of images to that field. Using a hook in /site/ready.php you can display a field error in Page Edit if the number of images in the field does not match the required number. Just like the standard "required" behaviour, the requirement does not prevent the field being saved if the number of images is not correct so you would still want to check the image count in your template. $wire->addHookAfter('InputfieldImage::processInput', function(HookEvent $event) { $inputfield = $event->object; // Only for this field if($inputfield->hasField != 'images') return; // Only in ProcessPageEdit if($this->process != 'ProcessPageEdit') return; $page = $this->process->getPage(); // Only for this template if($page->template == 'home') { if(count($inputfield->value) !== 4) $inputfield->error("Please upload exactly 4 images to this field"); } });
  17. Hi @adrian I just discovered the feature where the Captain Hook panel links the hookable method name to the API Explorer (if it is installed I guess). This is very cool. But just wondering if you could have it open the API Explorer in a new tab, to avoid navigating away in the current tab?
  18. It's often better to use a PW page for your AJAX url than a standalone PHP file - just create a special template / template file / page for the purpose and call it in your AJAX function. That way everything in PW, init.php, etc, is available just like normal.
  19. Yes, see the "Setting restrictions via a hook" section of the first post / readme.
  20. Hmmm, neither of those is a very good transliteration. $sanitizer->pageNameTranslate() gives the better result of prospere-jouplaboum, which is also the same result you get if you paste the name when adding a user via the PW admin. Seems like the core should be using that in PagesEditor instead of the Sanitizer::toAscii option.
  21. This fieldtype module is part of the core but it is not installed by default. Install it via Modules > Install > FieldtypeFieldsetPage
  22. Hi @bernhard, This module's inputfield is not initialising when AJAX-loaded. So when inputfield visibility is set to "Open when populated + Closed when blank + Load only when opened (AJAX)", and inside AJAX-loaded repeater items.
  23. You're right; I created a new issue for this: https://github.com/processwire/processwire-issues/issues/395 I know, I was just kidding a bit because I think for most people fieldgroups are one of the more arcane aspects of PW.
  24. For high mail volumes something like Mailgun is probably better. I've only used WireMail Mailgun in one project so far but it worked great.
×
×
  • Create New...