Problem/Motivation

In #2577433: Create formatter for displaying Tweets and in #2 we added formatter for Tweets and improvements for it. Currently we support link and string fields. It would be nice to also support entity reference fields that reference appropriate media bundles.

Proposed resolution

Let's add support of entity reference too.

It is OK to have two separate formatters if needed. Any common code that could be share can be added to Drupal\media_entity_twitter\Plugin\MediaEntity\Type\Twirter type provider.

Also make sure to implement isApplicable() in a way that makes sense (make sure field really represents tweets).

Comments

slashrsm created an issue. See original summary.

slashrsm’s picture

slashrsm’s picture

Issue summary: View changes

#2 merged. Updating summary.

slashrsm’s picture

Title: Improve Tweet field formatter to support other field types » Improve Tweet field formatter to support entity reference fields

  • slashrsm committed c62e1d4 on 8.x-1.x authored by phenaproxima
    Issue #2621950 by phenaproxima: Added string and string_long support to...
luksak’s picture

Assigned: Unassigned » luksak

Looking into this tomorrow.

mbovan’s picture

Assigned: luksak » Unassigned
Status: Active » Needs review

Discussed with @Berdir. We are not sure how this should look like for referenced entities (media entities).

Do we want to display a media entity or a media entity field/fields that are type of text or link (possible tweets :))?

In addition, there is a https://www.drupal.org/project/field_formatter module which is allowing us to select a field of a referenced entity and choose a formatter for it. In that case, it seems enough to support only text and link fields in TwitterEmbedFormatter.

slashrsm’s picture

Status: Needs review » Fixed

True. We can cover this with field_formatter. It was not there yet when I initially opened this issue.

Status: Fixed » Closed (fixed)

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