• Content count

  • Joined

  • Last visited

Community Reputation

48 Excellent

About oma

  • Rank
    Sr. Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

3,787 profile views
  1. I can check each item in the loop... just always strive to resolve everything in the query but maybe not possible in this case.
  2. Thanks for your reply, Robin. This makes a lot of sense and I like your breakdown of this a lot. I don't know too much about the isValidPage() method... can't find too much on the docs about it. Your code snippet line if($modules->FieldtypePage->isValidPage($item, $field, $page)) { What is this doing? isValidPage might be what I'm after but slightly confused by the arguments... Edit: Ah I see (I missed the $field declaration) but unfortunately this is still returning the event that has passed (even though it's now hidden from the PageField).
  3. Hi folks, I have a PageReference field which is selecting events (that are in date by a date field) and articles with a specific template. My hook in order to allow those pages is as follows: $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if ($event->object->hasField == 'home_whatson') { // Get in date events $events = new PageArray(); foreach ($event->pages->find("template=events-detail, events_detail_dates.events_detail_dates_start_date>=today, sort=events_detail_dates.events_detail_dates_start_date, sort=name") as $e) { $events->add($e); } // Get Our Picks articles $articles = new PageArray(); foreach ($event->pages->find("template=our-picks-detail, sort=sort") as $article) { $articles->add($article); } // Push events into the pages we allowed $events->import($articles); $event->return = $events; } } This works well but if an event has passed (before it is removed from the PageReference field), obviously it doesn't 'remove' it from the list it simply hides it (even though it's still technically 'selected'). I then need to do a check on the front end for this as well so it isn't returning the items that have passed. I thought this would work: $today = strtotime("now"); $articles = $page->home_whatson->filter("events_detail_dates.events_detail_dates_start_date>$today"); But it's obviously now ignoring the articles with the specific template as the filter is removing it from the list (as this should only be applied to events). Is there a way round this? Should I put removing it from the original query (using ->remove()) or is there some other way? Any help is appreciated.
  4. Apologies to bring this back up but I'm having a slight issue. This seemed to be working for me before but for some reason has stopped. I am using @Robin S's ConnectPageFields and my selector is template=tags,, tagged.count>0, sort=name It should return all tagged pages which use X template and count is > 0. I swear this was working before but now when I dump out the query it's written as ["selectors"]=> string(66) "template=tags,, tagged.count>0, sort=name, status<1024" } If I put 'tagged.template=' in the selector (obviously doesn't work but it's returned the same but when I use multiple sub selectors ( it seems to change it to Any thoughts?
  5. Actually what I ended up doing was this... $random = $articles->getRandom(); if ($article == $random) { ... Seemed to work pretty well.
  6. Thanks guys. Really appreciate it... so the only way to set the start is to include limit? That's good to know.
  7. Hi folks hope all is well. I'm wanting to insert a random repeater row into a page selector loop ($pages->find()) at a random point (after the 1st, after the 5th, after the 2nd – different each reload). I have managed to get a random repeater row and now I need to insert it into my returned pages... $ctas = $pages->get("name=site-settings")->settings_ctas; $cta = $ctas->getRandom(); $events = $pages->find("template=events-detail, events_detail_dates.events_detail_dates_start_date>=today, sort=events_detail_dates.events_detail_dates_start_date, sort=name"); // Return in-date events only I thought about using $a->insertAfter($item, $existingItem) and setting $existingItem to a random integer? Is this is the best way do you reckon?
  8. Does the "start" selector property still work? I am doing the following but doesn't seem to have any bearing... $articles = $pages->find("template=meet-the-locals-detail, start=3, sort=sort"); I liked modifying the selector query, rather than the results (with slice) as presumably it's a lot more efficient.
  9. Actually. My host said they updated the max_input_vars but they hadn't... so I just made this amend and seems to work!
  10. I think it's definitely to do with the amount of images... I've managed to add a new page alongside it, and make changes to that fine. If I duplicate one of the pages which has a lot of images on it... I can't edit it.
  11. Yep... increased as well as other stuff too. I've enabled debugging to true but not returning any messages I can edit other pages... just not these ones I've uploaded the images to via the API.
  12. When I click 'Save' I don't get any changed message either. Hmm.
  13. I actually can't seem to edit anything on that page... even if I fill out a text field it resorts to whatever it was before.
  14. Thanks for your help, @gmclelland – so there's no drawbacks to uploading via the API... it doesn't 'lock' the images or anything. Weird.