Problem/Motivation

Particularly for recurring dates with many instances, it may not be useful to list all instances.

Proposed resolution

Provide a specialized output formatter with appropriate configuration options:
- Show the plain text description of the rule (as provided by the recurr library's TextTransformer)
- Show a configurable number of upcoming instances (hard limit)
- Show a configurable number of upcoming instances, after which the instances will be hidden (soft limit)
- Show a configurable number of past instances (hard limit)
- Show a configurable number of past instances, after which the instances will be hidden (soft limit)

The idea with the hard/soft limits above is similar to how facets work in Drupal. The hard limit is the total number rendered to the page, but any beyond the soft limit will be hidden, with some kind of "show more" link to view them.

Here's what the result looks like (note: each type of past/upcoming set is in a details elements)

Comments

mandclu created an issue. See original summary.

mandclu’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new7.04 KB
new65.95 KB

The attached patch isn't quite as fancy as the original description, but it does allow for showing a configurable number of rows for both upcoming and past instances, as well as the text of the rule.

mandclu’s picture

StatusFileSize
new7.19 KB

Realized I had a slight inconsistency in how the output was being structured. This updated patch should fix that

steven buteneers’s picture

Status: Needs review » Needs work

I do like this feature and I was in fact looking for such a formatter to limit/summarise the output of recurring dates.]

The only problem I'm having with this is that it's now forced in a detail field. This is not really a nice solution for views rendering a teaser where I would like to use this kind of functionality.

I'm not quite sure what would be the best approach for this, perhaps providing some output options (E.g. plain, details etc..) to manipulate the output a bit more.

Edit:

1: After selecting this formatter I'm also getting some warnings in DBlog:

Warning: timezone_open(): Unknown or bad timezone () in Drupal\Core\Datetime\DateFormatter->format() (

2: I'm unable to set 0 (none) as a value for upcoming or past events. I want to be able to either show only upcoming events, only past events or both.

mandclu’s picture

Status: Needs work » Needs review
StatusFileSize
new9.83 KB

This updated patch adds an ability to select either details or a div container in the output configuration. In the latter case, the headings are set in an h4.

This should also fix the dblog warnings.

As for showing past or future events, I assume you're referring to a filter value for views. In my experience using a value of "now" (no quotes) will achieve what you're after.

steven buteneers’s picture

@mandclu ; I was referring to the settings where you can configure Recent and Upcoming Instances to show. If you set this to 0 it still shows them.

I was also thinking that maybe a theme implementation would be a better way to solve the output of the items? So themers can just override the template(s).

mandclu’s picture

StatusFileSize
new8.42 KB

Great suggestion about the theme implementation. This patch adds a twig template, which is a much better way to let a particular site customize the output to suit its needs, including not only the structure, but also the labels, etc.

I believe the issue with continuing to show values with a zero specified should be fixed now too.

  • mandclu committed 9c807ca on 8.x-2.x
    Issue #3105663 by mandclu: Output Formatter for Recurring Dates
    
mandclu’s picture

Status: Needs review » Fixed

I decided to merge this in so we can have a beta release. Please reopen if you find any issues.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.