Robin S

Members
  • Content count

    1,655
  • Joined

  • Last visited

  • Days Won

    83

Robin S last won the day on July 22

Robin S had the most liked content!

Community Reputation

2,329 Excellent

1 Follower

About Robin S

  • Rank
    Hero Member

Profile Information

  • Gender
    Male
  • Location
    New Zealand
  1. Hi @Martijn Geerts, Thanks for this module. I'm wanting to explore using it with a custom module that extends ProcessPageLister but the way the module checks if the page ID supplied to the url() method has the correct process is a stumbling block. In the module there is this test... if (strpos('ProcessPageListerPro', $listerPage->process) !== false) return $listerPage; ...which seems like a weird way to check that the process is okay. For instance, a process named 'age' would pass this test. And any process that has a different name yet may still be an instance of ProcessPageLister fails the test. How about a different test? $process_module = $this->modules->get($listerPage->process); if($process_module instanceof ProcessPageLister) return $listerPage;
  2. I'm having a bit of trouble understanding, but you can automate pretty much anything in PW - nothing has be done manually. Suppose you go with a Page Reference field for your options (which is usually the most flexible approach) - you can create new options (i.e. pages) on-the-fly as you import your data if you need to. But from what you say in the first post, it sounds like you already know the the options ahead of time and that is how you are able to set up the Table field with those options on the Home page. Instead of the Table field, create one page per option under some special branch of the page tree that is dedicated to that purpose. Set up a "Homepage Listung" Page Reference field that uses those pages as options. When you import the data you don't have to know the ID of the option (page) - you can find the option by title (e.g. "Bestätigt") or value (e.g. "JA1") and then set that option (page) for the "Homepage Listung" field.
  3. $index is the key of the array item, which in the case of a PageArray like this is the zero-based index of the item in the array. So it starts at 0 and goes up with each subsequent item. The "</div><div class='col-6'>" portion is where we end the first column and start the second column. There was an error in my code which I have corrected now - we only want this inserted once, when $index matches half the number of items in $testimonials rounded up to the nearest whole number.
  4. Hi @HarryPhone, If I understand right, what you are doing looks more complicated than it needs to be. If you just need values/titles in a select inputfield and your site editors don't need to edit these options then you can define the values/titles in an Options field: https://processwire.com/api/modules/select-options-fieldtype/#separate-option-values If your site editors do need to edit or add new options then you can use a Page Reference field. In the template for the pages you would use the Title field for the option title and add a text field for the option value.
  5. Nice tutorial, thanks! You could simplify the methods a little by making sure you always get the Images field as a Pageimages array, e.g. $wire->addHookMethod('Page::siteFeaturedImage', function($event) { $page = $event->object; if ($page->template != "article") { throw new WireException("Page::siteFeaturedImage() only works on 'Pages of article template', Page ID=$page is not such!"); } $article_featured = $page->getUnformatted('article_featured'); // always a Pageimages array if (count($article_featured)) { $img_url = $article_featured->first()->url; } else { $img_url = urls()->templates . "assets/img/missing-article_image.jpg"; //we show this when image is not available } $event->return = $img_url; });
  6. Nice one. Just another way to skin the cat... <?php $testimonials = $page->testimonials; $testimonials->shuffle(); $firstTestimonial = $testimonials->shift(); ?> <div class="jumbotron jumbotron-fluid bg-color"> <div class="container"> <h2><?= $firstTestimonial->title; ?></h2> <p><?= $firstTestimonial->testimonialBody; ?> - <i><?= $firstTestimonial->testimonialReviewee; ?></i></p> </div> </div> <div class='container'> <div class='row'> <div class='col-6'> <?php foreach($testimonials as $index => $testimonial): ?> <?php if($index == ceil(count($testimonials) / 2)): ?> </div> <div class='col-6'> <?php endif; ?> <h2 class='py-3'><?= $testimonial->title; ?></h2> <p><?= $testimonial->testimonialBody; ?></p> <p class="font-weight-bold text-muted">- <i><?= $testimonial->testimonialReviewee; ?></i></p> <?php endforeach; ?> </div> </div> </div>
  7. PM sent.
  8. I forked this module and made it PW3 compatible. See the readme and the commit for details of what was changed. https://github.com/Toutouwai/ProcessBatcher If folks want to test it and report back I can make a pull request for @Wanze. @tpr, I hid the AdminOnSteroids datatables filterbox and the title case-change button because the layout was a bit messed up. Maybe you could take a look at that when you have time?
  9. Module

    @robinc, check out this module code in a Gist by @adrian: https://gist.github.com/adrianbj/2b3b6b40f64a816d397f
  10. Hi @joshuag - any update on this issue? Are you able to reproduce the issue at your end?
  11. Not saying it's a good idea because I have no idea how stable it would be, but if you wanted to share all the modules between the sites you could do something like this in each /site/config.php: $config->paths->siteModules = $config->paths->root . 'shared/modules/'; $config->urls->siteModules = $config->urls->root . 'shared/modules/';
  12. There is this: If you are looking at doing more specific searches with FieldtypeComments::find() be aware of this issue.
  13. Edit permission is set per template, so just don't give the role edit permission for the parent template. Scratch that - it seems the edit permission is needed in order to give the sort permission. What's more, the docs say that you give the page-sort permission on the parent template to make the children sortable, but that doesn't work for me if the child pages are not themselves editable. Weird. Looks like this has been raised before without any solution:
  14. Also see this post: