Jump to content

Recently Updated Topics

Showing topics posted in for the last 7 days.

This stream auto-updates

  1. Today
  2. If you just want to sync the fields and templates you can also try the native fields/templates export/import. For most fields this works quite well. Thats how I usually do it. Sometimes I also do it the other way around and import all the pages that have changed from production to local with the native page export/import and than export the whole database (using ProcessDatabaseBackups module) from local and import that on the production site. RockMigrations is also great and I have used it for more complex stuff. One thing I did not find in RockMigrations is the option to migrate pages. Can that also be done?
  3. That is what I thought. Thanks for extra research and tips.
  4. Yesterday
  5. Thanks for the suggestion @BitPoet. But these config settings are for fields using the Fieldtype (and stored in the "fields" table) rather than part of the module config (stored in the "modules" table). I did get to the bottom of why the problem exists and how to work around it: You would think that when setting a default value you could check if the config setting is null (or not part of the data array for the Field) - if it's null then it means it's never been set, and if it's an empty string then it means the user has deliberately cleared the value. But saving a field goes via WireSaveableItems::save() -> WireSaveableItems::encodeData() -> wireEncodeJSON(), and the last is used without $allowEmpty set to true. So any empty value is removed from the saved data and therefore the setting will be null rather than an empty string. I saw a solution in FieldtypeText::saveFieldReady(). In your Fieldtype module you do this to check if a Field is newly created and if so set any default config values: /** * Hook called when field is about to be saved * * @param Field $field * @since 3.0.212 */ public function ___saveFieldReady(Field $field) { parent::___saveFieldReady($field); // If the field is new (it has no ID) and is being saved in ProcessField... if(!$field->id && $this->wire()->page->process == 'ProcessField') { // Set some default field config values $field->set('myFieldtypeConfigSetting', 'foo'); // ... } } This method is only available in PW >= 3.0.212 so I guess prior to that you only had the unappealing option of creating an additional autoload module bundled with your Fieldtype module and hooking Fields::save().
  6. @adrian Just want to come back 8 years later and mention that this saved me a lot of time today 🫡
  7. Oh, ok. So you add those fields to a page you already have set up (the parent page). So if I have a parent page (forms) that has a bunch of child form pages underneath, I would add those fields to the parent forms page and upon running the import, it would put all the individual form pages under that.
  8. Hey, @Neue Rituale & @wbmnfktr just thank you for the module, nice and handy !!!
  9. Last week
  10. Oh cool, many thanks.
  11. No unfortunately not. I wrote a new module WireMailBrevo that uses the API to connect instead. https://processwire.com/modules/wire-mail-brevo/
  12. I'm on PHP 8.3 and currently running into exactly the same issue as @gebeer. I intend to add a white background to images being in arbitrary ratios to fit them into a fixed-size rectangle. @horst What is the difference between this and the PIA module? Is it recommended to use the latter?
  13. Let's say I have Fieldset Group called Tables that contains 3 x Pro Fields table. Each table is label, value where label is set via the API and is readonly (see below). If I set the field to be Closed on load, how can I set it so that if in any of the tables if value is empty instead of seeing a closed fieldset: Tables ... I get something like: Tables ... 7 missing values or Tables (7 missing values) ... (either is okay) Additional questions: I also want to hide the new row button but I think I can easily do that with CSS. Use this CSS: li#Inputfield_{myFieldName}pageText a.InputfieldTableAddRow { display: none; } How can I make the label field in the table readonly, add readonly=readonly to the settings for that column doesn't do it. Use this JS: $('input.{myFieldName}-label').attr('readonly', 'readonly').attr('onfocus', 'this.blur()').css('opacity', 0.6); How to sort the table A to Z by label Didn't realise there is a setting for this, great! Thanks. EDIT: Here's how I did it: \ProcessWire\wire()->addHookAfter('ProcessPageEdit::buildForm', function(\ProcessWire\HookEvent $event) { $object = $event->object; $form = $event->arguments('form'); $page = $object->getPage(); $page->of(false); if ($page->myField) { $toAction = 0; foreach ($page->$myField as $row) { if (!$row->value) { $toAction ++; } } if ($toAction > 0) { $form->prependMarkup('<div class="pw-container uk-container uk-container-expand"><div class="uk-alert uk-alert-danger"><span class="fa fa-exclamation-circle"></span> Check the <strong>Page text</strong> tab; ' . (int) $toAction . ' value(s) needs entering</div></div>'); } } });
  14. Hey everyone! After the StripePaymentLinks module has been running smoothly, a few customers with multiple Stripe accounts asked for better analytics capabilities. The Stripe dashboard is okay, but when you have multiple accounts and need specific analysis, it quickly becomes tedious. StripePlAdmin is an admin interface that displays the data stored by StripePaymentLinks in three perspectives: Purchases: All transactions with customer details, subscription status, renewals Products: Aggregated product performance (revenue, purchases, quantities) Customers: Customer lifetime value, purchase behavior Features: Configurable columns per tab Dynamic filters (Boolean search, date ranges, number ranges) Clickable product/customer names open detail modals CSV export with active filters Summary totals at table footer You can show/hide columns and filters in the module settings as needed. Everything is very flexible. Available on GitHub and in the Modules directory. Feedback welcome! 🚀 Cheers, Mike
      • 6
      • Like
  15. Hi @hellomoto Thanks for the solution. I will try your solutions later. Gideon
  16. Because the code module is permanent, despite setting permanent=false in the site module, it won't uninstall. Attempting to do so only deletes the settings.
  17. @bernhard I completely forgot about this post and ended up with a solution. I do have a default block and did implement this as you described. Interestingly I did this on my own having missed your reply. So we were thinking in the same direction.. This is ultimately what I came up with and this made it much easier to implement a solution and with less effort. This is a simple example of a block with an image marquee. I only want the block to render if there are images that will show up on the page. <?php // rest of block... /** * Renders this block if conditions are met */ public function renderBlock(): string|Html { if ($this->images->count()) { return ''; } parent::renderBlock(); } // rest of block... I added a renderBlock() method that overrides the parent Block::renderBlock(). It contains all of the logic that determines if a block will render. For a complex block that has multiple fields that need to be checked this can be very helpful. It is also very clean and simple since that method is automatically called when RPB renders blocks anyway. I think this is better than an entirely new method like shouldRender() In my case there are blocks which have an ASM page select. The pages that can be selected may become unpublished or hidden which will remove them from the selected pages. If there are no pages left to render then renderBlock() will return an empty string and prevent it from rendering without any need to go through the site and hide blocks that don't have any pages. This allows for dynamic changes in content and the block always behaves as needed. Thank you for working on a solution and apologies that I missed it!
  18. I know that a lot of you enjoy some AI assistance while coding, therefore I wanted to point you to this deal: Compared to Claude Sonnet 4.5 I use Z.AI GLM 4.6 for quite some time now in OpenCode and Cline and I am super happy with it. For the price the results are awesome. No fear to ask for another iteration as usage limits are way higher than in Claude Code, Codex, and probably many others. Works in almost all tools availabe, see here: https://docs.z.ai/scenario-example/develop-tools/claude I am not affiliated with them so there is just this plain text link to their subscribe page. Take a look for yourself. ➡️ z.ai/subscribe
  19. @markus-th I checked it out and it works like treat!😀 A huge thank you from Dillingen to Kulmbach!
  20. Lovely!
  21. @spoetnik export/import works with multilanguage pages The new website has to have the same languages as the origin website. And you need to have the right paths for parents.
  22. Module is now in the modules directory: https://processwire.com/modules/snow-fall-animation/
  23. This does not work: // Prevent textual input from changing, e.g., if '2020-00-01' is entered, erase $this->addHookAfter('InputfieldDatetime::processInput', function(HookEvent $event) { // Get the object the event occurred on, if needed $InputfieldDatetime = $event->object; // An 'after' hook can retrieve and/or modify the return value $return = $event->return; // Get values of arguments sent to hook (if needed) $input = $event->arguments(0); $page = $return->hasPage; $fname = $InputfieldDatetime->attributes['name']; $val = $input[$fname]; // $old = $return->hasPage->$fname; // bd(date('Y-m-d', $old)); /* Your code here, perhaps modifying the return value */ $fmt = $page->getField($fname)->dateInputFormat; // bd($fmt); $new = date('Y-m-d', strtotime($val)); if ($val == $new) return; // bd($val, $new); $this->wire->error( sprintf("Skipping field `%s` date string input: '%s' (format='%s')", $page->getField($fname)->get('label|name'), $val, $fmt) ); $return->hasPage->$fname = ''; // clear value // Populate back return value, if you have modified it $event->return = $return; }); I guess it might be better hook sanitizeValue in the Fieldtype? Sorry I'm getting very confused. The $event->return->hasPage->$fname has worked in prior tests, but I'm also confused because initially that property is set to the old value.
  1. Load more activity
×
×
  • Create New...