Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


eelkenet last won the day on October 16 2019

eelkenet had the most liked content!

Community Reputation

102 Excellent

About eelkenet

  • Rank
    Full Member

Profile Information

  • Gender
    Not Telling
  • Location

Recent Profile Visitors

2,479 profile views
  1. For what it is worth, I use this intermediate solution to use ProCache in combination with the RestAPI module: https://processwire.com/talk/topic/20006-module-restapi/?do=findComment&comment=186881. Which gives me: 1. site.url/rest-api => live data 2. site.url/api => served by ProCache Of course this would only be useful for (static) pages that don't require any authentication or whatsoever.
  2. Removing $config->imageSizerOptions from config.php solved the issue, which lead me to test its settings. Turns out specifically setting webpAdd to false fixed it!
  3. Thank you for you insightful reply @Robin S! I've decided to step away from the FieldstePage method, and just creating simple fields with longer names. Takes some time to copy over all existing data, but it makes it all a lot simpler to deal with.
  4. Hi, I'm working on a process module which hooks after ProcessPageEdit::buildForm. // Inside the module's init() method: wire()->addHookAfter('ProcessPageEdit::buildForm', $this, 'renderFieldsAccordingToStop'); Using a lot of variables, the script decides then which fields to render and which ones to hide. It also dynamically sets the 'required' flag to only the visible fields, making sure the proper warnings get shown but only when these fields are visible. It's all quite straight-forward, when it comes to the regular InputFields: /** * Render the form, and hide all the fields that are not part of the currently active step * Note: These fields are hidden with the css class "hideme", as hiding them with collapse logic gave issues in combination with the dynamic requirements * * @param mixed $event * @return void */ public function renderFieldsAccordingToStop(HookEvent $event) { $return = $event->return; // Get the page that is currently being loaded $page = $event->object->getPage(); $input = wire("input"); $form = $event->arguments(0); $step = $this->getProgress($page); // Add some class to hide field when needed $html = "<style>.hideme{display: none;}</style>"; $form->prependMarkup($html); // Get all the fields inside the form $inputfields = $form->getAll()->not("id=submit_save"); // Set all inputfields according to step foreach ($inputfields as $key => $inputfield) { // Run some logic to decide if the field should be invisible (using CSS to hide, as the inputfield->collapse gave issues) if ( ... ) { $inputfield->wrapClass("hideme"); } // Else make sure to require it. else { $inputfield->required(true); } } } This works fine for most field. However, this does not work for fields that are embedded inside a FieldsetPage. The FieldsetPage itself does get set to required correctly, but the fields inside are not, and as a result a user can now skip these fields while I wish them to be required (but only when visible). I've tried a bunch of different techniques, but I can't get the fields inside of the FieldsetPage to become required. In fact, I can't figure out how to address these from inside the hook at all. The furthest I've gotten is access the names of the fields inside this FieldsetPage: $field = $inputfield->hasField; if ($field->type == "FieldtypeFieldsetPage") { // Get the inner fields foreach ($field->repeaterFields as $f) { $repeaterFieldName = wire()->fields->get($f); $subfieldName = "{$field}->{$repeaterFieldName}"; self::log("The current field inside the FieldsetPage is: $subfieldName"); //--> logs "myfieldset->myfield" } } But how on earth do I use that information to update the settings of the Inputfield for myfieldset->myfield? Especially how do I set the required property, but also in a more of a general question. (In addition, I also tried hooking into the Inputfield::render but to no avail. ) Thanks in advance!
  5. Thanks for your replies guys! Here is the output when outputting all the debugInfo inside the JSON. What seems interesting to me is that every variation seems to refer to itself as the original? That could be something maybe? The weird thing is, I use this exact same technique on a lot of sites and never had this issue. So I would guess it's some configuration setting somewhere that might be off.
  6. Bump. ALL suggestions are welcome here!
  7. Hey everyone, I have a weird one. Somehow my image variations keep being regenerated, instead of served directly. The variations that are requested are in fact already present, but still get overwritten by (identical!) files upon page load, making everything rather tedious and slow. Permissions from config.php are set to default: <?php $config->chmodDir = '0755'; // permission for directories created by ProcessWire $config->chmodFile = '0644'; // permission for files created by ProcessWire ?> Files before loading the page, notice the time of the requested variations is 14:14: Same folder after loading the page just now (14:24): Some background: I'm currently implementing my standard technique (using the RestApi module to output json) on an older but updated site (3.0.148), running on PHP 7.2.22 (MAMP Pro), while still in (local) development. My image parser function is pretty basic: <?php public static function parseImage(PageImage $image) { $settings = [ 'sharpening' => 'medium', 'cropping' => false, "quality" => 95 ]; $sizes = [ "L" => [ "width" => 1500, "height" => 1500, "settings" => $settings, ], "M" => [ "width" => 750, "height" => 750, "settings" => $settings, ], "S" => [ "width" => 320, "height" => 320, "settings" => $settings, ], ]; // get orientation if ($image->width > $image->height) { $orientation = 'landscape'; } else { $orientation = 'portrait'; } $resulting_image = [ 'name' => $image->name, 'description' => self::parseLanguageField($image->description), "focus" => "{$image->focus()["left"]}% {$image->focus()["top"]}%", 'original' => [ 'src' => $image->url, 'width' => $image->width, 'height' => $image->height, 'orientation' => $orientation, ], ]; foreach ($sizes as $sizeName => $size) { $img = $image->size($size["width"], $size["height"], $size["settings"]); $resulting_image[$sizeName] = $img->url; } return $resulting_image; } ?> With (for the image above) the following output once rendered as JSON: "image": { "name": "cirkels_oo.jpg", "description": [], "focus": "50% 50%", "original": { "src": "/site/assets/files/2823/cirkels_oo.jpg", "width": 300, "height": 240, "orientation": "landscape" }, "L": "/site/assets/files/2823/cirkels_oo.1500x1500.jpg", "M": "/site/assets/files/2823/cirkels_oo.750x750.jpg", "S": "/site/assets/files/2823/cirkels_oo.320x320.jpg" }, Any ideas on what might be going on? Probably missing something very obvious here.. EDIT: I tried explicitly including 'forceNew' => false in the settings, but that gave the same result
  8. Ran into this problem today, thanks for asking this question 3,5 years ago @heldercervantes. Would have been hard to debug if you hadn't.
  9. Have you tried this? https://processwire.com/api/ref/pagefiles/delete/
  10. Did you check the database to see if the table is in fact still there?
  11. It depends completely on the payment provider you choose, there are several modules available, but they all require some hands-on programming. http://modules.processwire.com/search/?q=payment Also often payment providers require a callback-endpoint at your site to process the result of a payment action. If all goes well, it will call this endpoint while the user is waiting for a bit during the payment process. After your system processes and acknowledges the payment (for instance it changes the status of the user to 'registered'), the payment provide will then forward the user back to your site. But.. it can also be the case that this callback happens minutes, hours or even days later in case of a hiccup with the banking system for instance. And, in case of a credit-card payment, it can in fact even change the state of a payment a month later — should the user formally dispute the charge. So, the flow of registration -> payment -> access is not as 1-2-3 as it may seem. You will need to consider all the possible outcomes of your registration process. You will be able to read more about the exact information your payment provider sends and expects in return in their documentation, as this varies wildly. Another thing to consider is that you cannot depend on any $session variable during the callback function, as the payment provider has its own session. So you will probably have to pass the user-id to the payment provider while setting up the payment, which it in return should include during its callback to your server and which you can then use to look up the user. One other thing though, just in case you hadn't thought about this: you should never email users their passwords. With the exception of a single-use, time-constrained temporary password. For that purpose you can use the PasswordForceChange module.
  12. Thank you once again @Robin S, that is very helpful indeed. The other settings were mostly the result of me fiddling around trying to get the field back to working 👨‍💻💣⁉️☠️ I think it would be very helpful if this was clearly explained in the formatText's notes, as it is easy to overlook.
  13. So, this is a weird one. I initially thought this was a "CKEditor inside of Repeater Matrix"-problem, but for some reason a certain set of settings makes the CKEditor crash upon loading. I've tried on multiple systems, multiple browsers, and both on 3.0.123 (master) and the latest 3.0.142-beta. I'm probably making a simple mistake here, but couldn't figure it out. I've worked around the issue for now, but leaving this here for other to take a look at. To replicate: Import the following field, add it to a page, and try to edit. { "simple_body": { "id": 224, "name": "simple_body", "label": "Rich text with limited options", "flags": 0, "type": "FieldtypeTextareaLanguage", "inputfieldClass": "InputfieldCKEditor", "contentType": 1, "htmlOptions": [ 2 ], "minlength": 0, "maxlength": 0, "showCount": 0, "rows": 10, "toolbar": "NumberedList, BulletedList, PWLink, Unlink, SpecialChar, Sourcedialog", "inlineMode": 0, "useACF": 1, "usePurifier": 1, "toggles": [ 2, 4 ], "formatTags": "p;ul;li;a", "extraPlugins": [ "pwlink", "sourcedialog" ], "removePlugins": "image,magicline", "langBlankInherit": 0, "collapsed": 0, "textformatters": [ "TextformatterEntities" ], "showIf": "", "themeOffset": "", "themeBorder": "", "themeColor": "", "columnWidth": 100, "required": "", "requiredAttr": "", "requiredIf": "", "imageFields": "", "extraAllowedContent": "", "contentsCss": "", "contentsInlineCss": "", "stylesSet": "", "customOptions": "", "plugin_sourcedialog": "" } }
  14. Thank you very much @Robin S, I have been able to fix the issue! 🙂
  15. I just found out my fancy Float (Range) slider does not work with Repeaters, unless I disable AJAX for the repeater. This is because I pass the Inputfield's settings to the JS side of it through the $config->js route. For every field I use the unique settings of that field. On the InputField I set these accordingly: $otherFields = $this->config->js('InputfieldFloatRange') ? $this->config->js('InputfieldFloatRange') : []; $this->config->js('InputfieldFloatRange', array_merge($otherFields, [ "Inputfield_" . $this->attr("name") => [ 'precision' => $this->get("precision"), 'rounding' => $this->get("roundingMethod"), 'displayValueField' => $this->get('displayValueField'), 'min' => $this->attr("min"), 'max' => $this->attr("max"), 'step' => (float) $this->attr("step") ] ])); And retrieve them on the Javascript side: function getSettings(id) { return window.ProcessWire.config.InputfieldFloatRange[id]; } var settings = getSettings(event.target.id); // from a 'change' event on the slider However, when I create a new repeater item, it does not append that items slider's settings to the ProcessWire.config object, as I would have expected. I could use an alternative path (using data-attributes in the actual field), but would prefer to keep this neatly. So, does anybody know what I need to do to append my Inputfield's settings to $config->js dynamically, ie. upon creating a new repeater item (with AJAX)?
  • Create New...