Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/11/2021 in all areas

  1. Just a typo, a missing ">" in this line, $item->children-count() vs. $item->children->count(). <?php if($item->children-count()): // if there is a child page, loop through all the child page ?>
    1 point
  2. Easier said than done. I'll see what I can do. I can see that if you are using RockMigrations from the start, then the issue does not arise as all fieldnames will be lowercase. My situation is a bit different as I only use PW occasionally, and find the Admin UI, rather than a 'headless' approach, works better for me. However, I find migrations a pain. Consequently, I have started working on a UI interface module for your module, which is coming along quite nicely and which I will provide more details on once I have it in a reasonable state. It generates json files from the database which are then used as input to the migration, so it uses the existing fieldnames, which may not be lower case. Having run into this, as well as a few other problems with using RockMigrations in this way, I have switched to using the core code directly as I appreciate that RockMigrations was not designed with this in mind. For fields, I am using a modified copy of ProcessFieldExportImport::processImport() (although that has problems with options fields), for templates, I call ProcessTemplatesExportImport::setImportData() and am just using the standard API for pages. However, there are attractions in using the RockMigrations methods so I may return to this once all the UI stuff is working, particularly if you think it is a good idea.
    1 point
  3. This got me where I needed to go! This is what I did: $wire->addHookBefore('ProcessPageLister::execute', function(HookEvent $event) { if($event->page->process != "ProcessUser") return; $lister = $event->object; $lister->defaultSelector = 'name%=, firstname%=, lastname%=, email%='; });
    1 point
  4. I can confirm this issue with the latest dev at time of posting (commit 6146ba4eb1fa3650a43c789a98026d7af4b5e317)
    1 point
  5. Solved following BillH's advise: $p->icon->first()->set("modified", time()); $p->save("icon"); But it started to work only after addition of the last line! Thank you!
    1 point
  6. I had a different setup where I wanted my files served from a sub-domain (even though in the end it was from /site/assets/files), but it's somehow related. What I did was to point the sub-domain to /site/assets/files, and then add this hook in ready.php : $wire->addHookAfter("Pagefile::url", function($event) { static $n = 0; if(++$n === 1) { $file = $event->object; $url = $file->httpUrl; $host = wire("config")->httpHost; $url = str_replace("$host/site/assets/files", "sub.domain.com", $url); $event->return = $url; } $n--; }); You could replace "sub.domain.com" to "domainB.com/site/assets/files" (or even clear the "site/assets/files" part in your case). Hope it helps !
    1 point
  7. Hi @Sebi kann you confirm that the latest PW (3.0.173) breaks AppApi (404 on the routes) or is it something on my part. EDIT: confirmed it myself, Downgrading to 3.0.172 with no other changes solved the issue Thank you!
    1 point
  8. @ryan - also, do you have any thoughts about this request - something you think makes sense, or are you not willing to consider it? Thanks.
    1 point
  9. There might be a better approach, but this snippet in site/ready.php works for me: <?php namespace ProcessWire; $wire->addHookBefore('ProcessPageLister::execute', function(HookEvent $event) { if($event->page->process != "ProcessUser") return; # Put all fields that should be searchable by default here: $userSearchFields = ['email']; # We create a comma separated field selector string from the array above for use by ProcessPageLister $searchFieldsString = implode('', array_map(function($f) { return ", $f="; }, $userSearchFields)); $lister = $event->object; # ProcessUser appends the ", roles=" selector before our hook happens, so we inject our fields # before that part: $lister->defaultSelector = preg_replace( '/(?=, roles=)/', $searchFieldsString, $lister->defaultSelector ); }); ProcessPageLister builds its field list from the selector style string its $defaultSelector property. So you just need to put the names of your fields into the $userSearchFields array and ProcessPageLister will take care of the rest. If you want to completely replace the search field list, it's even simpler. <?php namespace ProcessWire; if($event->page->process != "ProcessUser") return; # Put all fields that should be searchable by default here: $userSearchFields = ['lastname', 'firstname']; # We create a comma separated field selector string from the array above for use by ProcessPageLister $searchFieldsString = implode(', ', array_map(function($f) { return "$f="; }, $userSearchFields)); $lister = $event->object; $lister->defaultSelector = $searchFieldsString; }
    1 point
  10. Unpoly 2 is promised to be released soon: http://triskweline.de/unpoly2-slides/#1 Powered with Bootstrap 5 it might be a game changer for me. I have never been a fan of Bootstrap but version 5 impressed me so far. With the (optional) integration I can't wait to see what sort of productivity boost is possible for me by building upon both.
    1 point
  11. My journey with CSS frameworks has been: Bootstrap v2 → Zurb Foundation → Bootstrap 3 → UIkit 2 → Uikit 3. This is over the course of 9 years, with plain CSS for several years before that. All of the frameworks I mentioned come with pre-define components along with the JavaScript to do the usual things like accordions, tabs, modals, etc. I really fell in love with UIkit 3 because it goes very deep with JS components, giving you things like filters, lazy loading and slideshow. With Bootstrap, you have to use 3rd party libraries to get the same level of functionality, which in the past has lead to breaking packages for whatever reason, compatibility issues and a lack of cohesiveness. Maybe my workflow these days would alleviate some of those issues, but the fact remains UIkit solves like 95% of my use cases. I completely see the appeal of Tailwind having done CSS for a long time, but the lack of an official set of JS components is holding me back from giving it a try. I'm still waiting to see how UIkit 4 turns out and see how much further they go with utilities. Or I just may sit down and write a set of UIkit classes using Tailwind @apply that uikit.js expects so components looks correct (has anyone done this?). But, that feels a little hacky.
    1 point
  12. I had the same problem, hope this will help someone. :) I have a multi language website with templates containing a page field called Tags, that the user can create on the fly. Here's a quick way to activate the secondary languages when a new tag is created, using the cool IftRunner module. Install the module https://github.com/ryancramerdesign/IftRunner Create a .module name inside /site/modules/IftRunner using the code below. Install this module "IftActionActivePageLanguages" you just created Go to Setup > Trigger/Action inside the admin dashboard Create a new trigger for a "Pages::saved" hook like the one shown in the screenshot.
    1 point
×
×
  • Create New...