Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

cst989's Achievements

Sr. Member

Sr. Member (5/6)



  1. I solved this by creating a new field and saving it with a hook, essentially... if($page->template == "news-post") { $page->set('has_media', $page->image->count || $page->slideshow->count || !empty($page->video_embed)); } now I can just check if has_media=1 But I'm still curious why my old approach stopped working
  2. We have just updated a ProcessWire site from 3.0.184 to 3.0.229 and the following selector has stopped working: template=news-post,image|slideshow|video_embed!='',sort=-created In other words, I'm trying to grab the latest articles for featuring on my homepage, as long as they have at least an image, slideshow or video - if not, they're not suitable for the location. Is there an obvious reason this should've stopped working in the latest version, and/or an alternative approach?
  3. Hello, following various guides on here in years past, I've always had a css file in the admin by editing /site/templates/admin.php and adding: $config->styles->add("/site/assets/css/dist/admin.css"); Now suddenly I find that this call is aggressively cached with a v=3.0.227 on the end. Even if I add my own cache-busting variable to the end, it's ignored in favour of this. Does anyone know how to get it to clear? Or never be cached? In the end, 3 commits later, I had to rename the whole file.
  4. Bump! Nobody know if this is possible? Am I explaining the question badly? Edit: revisiting this so much later, I had a brainwave, I can simply target the field with some custom CSS: .ProcessPageEdit-template-hotel .Inputfield_gallery .Inputfield_map { display: none; }
  5. That's correct yeah and it did kick me out as expected. Clearing my cookies seems to have worked, thanks!
  6. I changed the name of "Admin", which worked as expected, and I've done many times before. However, internal links, like Setup > Templates are not updating Is there something I could do - a cache I could clear perhaps (tried object cache, procache and browser cache) - to try and solve this? This happens locally on a ddev site and in staging which is an apache/cpanel site
  7. Using the "show only if" logic on a Fieldset (Page) field settings, can I target the template of the page that's currently being edited? I think this is more complicated than it should be because the page in question is actually that kind of sub-page containing the fields E.g. template='hotels' page.template='hotels' parent.template='hotels' image of what I'm looking at...
  8. I just recently started using DDEV and it's great. However I do have one issue with it out of the box, it seems like ProcessWire's normal error reporting doesn't work for me when debug mode is on. Instead I get the standard 500 error message that would normally be shown to a logged-out user. Anyone else run into that? This is when not using Tracy Debugger. When using Tracy, it does show errors, but only if I manually set it to DEVELOPMENT mode, it's not able to DETECT that.
  9. We would like to know about this too @ryan!
  10. This module is looking great and I really appreciate all the effort that's gone into describing how to get started, videos etc.. Our team (myself excluded) is experienced with Phinx for database migrations on non-ProcessWire projects. From what I understand, a good thing about Phinx is that a file is created for each migration, that migration will only be run once, the database will record that the migration has been run, and the file will be ignored from then on. It also has a nice CLI that creates the file, dated, with the structure ready to go. I'm thinking I could write something to make it work this way... a module that manually keeps track of all these files and then creates a list, in date order, with any new files and passes that list to $rm->watch()? Or am I reinventing the wheel with something which goes against the logic of RockMigrations...? I suppose the main aim is to idiot-proof the process so nobody edits old migrations.
  11. I should add that I imagine this whole thing would be better off in a module, and not using a field but some custom way to store and filter the data, however that's not something I have time for at the moment! To me it seems a bit wild that this isn't possible by default. It's kind of like it's more of a "translated from English" module than a multi-lingual site.
  12. Is there an answer for this? I would like to know this also. I have considered (and it has been suggested before) that you could add a custom field for disabling the page in the default language. Then throw a 404 easily if that field is checked. However the issue remains with any selectors, find() etc. that are listing pages. They correctly check for the "Active" checkbox for non-default languages, excluding pages in menus etc.. But you would have to manually update any existing selectors to exclude pages with this new field checked. Unless there's a way to modify core selector process and exclude pages at the top level? Maybe with a hook on $pages->find()? I don't know if that's possible. Edit: this is how I've done it, however I suspect I've probably missed something as I've not tested it thoroughly yet... exclude_in_default_language is a checkbox field $this->addHookBefore('PageRender::renderPage', function() { if(!$this->user->isSuperuser() && $this->user->language->id == $this->languages->getDefault()->id && $this->page->exclude_in_default_language == 1) { throw new Wire404Exception(); } }); $this->addHookBefore('Pages::find', function(HookEvent $event) { $selector = $event->arguments(0); if ( !is_int($selector) && /* seemed to run into an issue with selectors like $pages->find(27) which loads the 404 page, this is just here to tackle that */ !empty($selector) && /* not sure why this would ever happen but I think appending with a comma would be an issue if it did */ $this->page->rootParent->id != 2 && /* exclude admin */ $this->user->language->id == $this->languages->getDefault()->id ) { $selector = $event->arguments(0); $selector .= ', exclude_in_default_language<1'; $event->arguments(0, $selector); } }); Edit 2: Pagination might still be a problem, not sure if this works Ideally I'd have used addHookBefore on the Pages:find, but I struggled in that case searching against a field that might not exist. Updated the hook to "before"
  13. Thanks Robin, what a dope, I know that the query needs sanitizing it just escaped my brain for a moment.
  14. Hi there, recently found myself wanting to search through nested repeater items on a page, for reference they were FAQs, organised into FAQ groups, so: faqs_group (parent repeater with group title) faqs (repeater item with title/body) faqs (repeater item with title/body) faqs (repeater item with title/body) faqs_group faqs faqs Etc. However, when I do a search of these FAQ items, I don't want them grouped anymore, just want to find the FAQ items and display them all. Firstly I searched using the repeater_faqs template that Processwire generates, that works fine once you add check_access=0 since this template shouldn't normally be searched by regular users (found in another thread on here) - but then I need to narrow it down to just those FAQs on the current page so that the search doesn't find items related to totally different pages in the future. The only way we could figure out to do this was to loop through all the FAQs on the page, grab their IDs, then limit our search result to these IDs. This is what I ended up with, but I feel like there must be a better way using the API that I missed? $ids = []; foreach ($page->faqs_groups as $group){ foreach($group->faqs as $faq){ $ids[] = $faq->id; } } $ids = implode('|',$ids); $results = $pages->find("id=$ids, title|body*={$input->get->search}, template=repeater_faqs, check_access=0");
  • Create New...