Problem/Motivation

ChangedItem is similar to TimestampItem and CreatedItem, but their default formatter is not available to ChangedItem.

I have classed this is a bug, because currently there is no way to display ChangedItem values when viewing entities.

Proposed resolution

Alter TimestampFormatter's plugin definition to allow it to be used with ChangedItem too.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Xano’s picture

Title: Add a formater for ChangedItem » Add a formatter for ChangedItem
Status: Active » Needs review
FileSize
487 bytes
Xano’s picture

FileSize
1005 bytes

Let's do the same for TimestampAgoFormatter and fix a bug there while we're at it.

Xano queued 2: drupal_2415937_2.patch for re-testing.

Xano queued 2: drupal_2415937_2.patch for re-testing.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Tested this out by adding some display options to node and it works beautifully. Nice!

I found two nice bugs along the way, will open in a minute.

tstoeckler’s picture

tstoeckler’s picture

FileSize
13.1 KB
9.91 KB

Well, why not share some screenshots, if I had to jump through all those hoops already :-)

A node showing the changed field formatted with the Time ago formatter

A node showing the changed field formatted with the Default timestamp formatter

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests
+++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampAgoFormatter.php
@@ -23,7 +23,7 @@
- *     "updated",
+ *     "changed",

Given that we had to make this change I think we should include some tests.

Xano’s picture

Status: Needs work » Needs review
FileSize
2.65 KB
3.63 KB

The last submitted patch, 9: drupal_2415937_9_test_only.patch, failed testing.

Xano’s picture

Issue tags: -Needs tests
FileSize
4.27 KB

I added pass asserts and modules are now enabled more selectively.

Xano queued 11: drupal_2415937_11.patch for re-testing.

Xano queued 11: drupal_2415937_11.patch for re-testing.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Wow, impressive test!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed 1fadbc0 and pushed to 8.0.x. Thanks!

  • alexpott committed 1fadbc0 on 8.0.x
    Issue #2415937 by Xano: Add a formatter for ChangedItem
    

Status: Fixed » Closed (fixed)

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