Cannot access Manage Display page when used with Smart Date module

Created on 26 May 2023, over 1 year ago
Updated 24 June 2023, over 1 year ago

Problem/Motivation

If a content type has a field using the Smart Date module, an error displays when navigating to the Manage display admin page.

The website encountered an unexpected error. Please try again later.
Error: Class "Drupal\smart_date_recur\Plugin\Field\FieldFormatter\SmartDateRecurrenceFormatter" not found in include() (line 28 of modules/contrib/inotherwords/src/Plugin/Field/FieldFormatter/InotherwordsDateRangeFormatter.php).

Steps to reproduce

  1. Install and enable the Smart Date module
  2. Install and enable the In Other Words module
  3. Create a content type with a Smart Date field
  4. Add at least one node using that content type.
  5. Navigate to the Manage Display admin page for that content type

Note that this error displays, even if there is not a field on the content type using an In Other Words field formatter.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cedewey Denver, CO

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @cedewey
  • πŸ‡ΊπŸ‡ΈUnited States cedewey Denver, CO

    I marked this major since Smart Date is a popular contrib module, but I could see the argument for bringing this back to the normal priority.

  • πŸ‡ΊπŸ‡ΈUnited States cedewey Denver, CO
  • πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

    Note: After enabling the smart date recur module and datetime range module, there was still an error:

    Fatal error: Declaration of Drupal\inotherwords\Plugin\Field\FieldFormatter\InotherwordsDateRangeFormatter::viewElements(Drupal\Core\Field\FieldItemListInterface $items, $langcode) must be compatible with Drupal\smart_date_recur\Plugin\Field\FieldFormatter\SmartDateRecurrenceFormatter::viewElements(Drupal\Core\Field\FieldItemListInterface $items, $langcode, $format = '') in /app/web/modules/contrib/inotherwords/src/Plugin/Field/FieldFormatter/InotherwordsDateRangeFormatter.php on line 181

    Still, adding in commit 4ff736e in 2.0.x the requirement on both those modules, as a first step.

    But we will remove this from the new 3.0.x branch, the formatter is almost entirely redundant with ones provided by Smart Date itself. As noted in the commit message removing it:

    > Features like 'August 3rd through September 1st' are only capability that
    > In Other Words provided that Smart Date didn't already, i think, and if we
    > want that functionality it should first be a feature request at Smart Date
    > and if not accepted build on Smart Date (not retrofitted like before) in a
    > submodule so that the date dependencies don't end up in In Other Words.

  • πŸ‡¨πŸ‡¦Canada mandclu

    I'm the maintainer of Smart Date and would be happy to help these modules work better together

  • πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

    Thanks @mandclu! In Other Words is about natural language formatting or condensing lists of stuff. The 2.0.x branch was a mess because it had already done a lot of date shortening, and then bolted Smart Date on top of it. That's not worth fixing!

    For the 3.0.x branch, though, the question really is if there's anything In Other Words can do that couldn't just as well live in Smart Date itself. I suppose we allow prefixes and suffixes, so we could extend Smart Date's formatters with that. But that's not a super compelling use case. The only thing i know offhand that we did that i think Smart Date doesn't yet is allow the connecting word to be chosen, so it could output for example "August 3rd through September 1st".

    Would you entertain a feature request for something like that, or should we make that a feature in In Other Words?

  • πŸ‡¨πŸ‡¦Canada mandclu

    Smart Date formats do have a "Time separator" property which does allow a site builder to set this connecting word. If there are additional ways Other Words would like to add to Smart Date's formatting, the Date Augmenter API β†’ is a way to make additional capabilities available. I'd be happy to provide additional information if there's interest in providing the prefix and suffix capabilities in one or more DateAugmenter plugin classes. Here's a simple example for reference.

  • πŸ‡¨πŸ‡¦Canada mandclu

    Looking at the blog post you linked, there may also be an opportunity to leverage Other Words with recurring dates, for example when creating the text to describe on which days an event will recur.

Production build 0.71.5 2024