Problem/Motivation

Hi, when decorating the date.formatter service, this module stops working because it expects a specific class in dependency injection.

Proposed resolution

Replace the DateFormatter class with the DateFormatterInterface interface in dependency injection.

Issue fork diff-3400477

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kksandr created an issue. See original summary.

kksandr’s picture

Title: Replace DateFromatter with DateFromatterInterface in DI » Replace DateFormatter with DateFormatterInterface in DI
Status: Active » Needs review
davidmv97’s picture

Hello everyone, I have conducted tests with the module without applying the patch published by kksandr, and I cannot identify the issue associated with this case. After applying the patch, I also don't see any errors. However, I consider it important to determine how to reproduce the issue in order to know if the problem has been resolved.

kksandr’s picture

@DavidMV97, you need to define a decorator for the date.formatter service, after which the module breaks in places where the date.formatter service was used, such as on the node revisions page.
For example:

services:
  date.formatter.decorator:
    # You need to implement this.
    class: Drupal\your_module\YourDecoratorDateFormatter
    decorates: 'date.formatter'
    decoration_priority: 50
    arguments: [ '@date.formatter.decorator.inner' ]

kksandr’s picture

Fixed in #3313385