Problem/Motivation

Right now the ERR fields can be displayed only using the "Rendered Entity" and "Label" formats. The ID formatter also has multiple real world use cases although it does not make much sense for Paragraphs. In my case, I have a reference field using the ERR and I want to use the ID in views re-write results while in another scenario I'm trying to embed another view with the help of Views Field View and passing the ID value as a contextual filter.

Proposed resolution

Add a new field formatter called "Entity ID".

Remaining tasks

User interface changes

N/a

API changes

N/a

Data model changes

N/a

CommentFileSizeAuthor
#3 id-formatter-3499568-1.patch8.5 KBab.shakir
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

ab.shakir created an issue. See original summary.

ab.shakir’s picture

Status: Active » Needs review
StatusFileSize
new8.5 KB
trackleft2’s picture

Status: Needs review » Needs work

This merge request introduces new PHPCS issues.

--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 14 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
FILE: ...68/src/Plugin/Field/FieldFormatter/EntityReferenceRevisionsIdFormatter.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
  6 | WARNING | [x] Unused use statement
    |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
 43 | ERROR   | [x] Expected 1 blank line after function; 0 found
    |         |     (Squiz.WhiteSpace.FunctionSpacing.AfterLast)
 44 | ERROR   | [x] Expected 1 newline at end of file; 2 found
    |         |     (Drupal.Files.EndFileNewline.TooMany)
 44 | ERROR   | [x] The closing brace for the class must have an empty line
    |         |     before it
    |         |     (Drupal.Classes.ClassDeclaration.CloseBraceAfterBody)
--------------------------------------------------------------------------------
FILE: ...visions-3499568/tests/src/Kernel/EntityReferenceRevisionsFormatterTest.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AND 1 WARNING AFFECTING 4 LINES
--------------------------------------------------------------------------------
 236 | ERROR   | [x] Expected 1 newline at end of file; 0 found
     |         |     (Drupal.Files.EndFileNewline.NoneFound)
 236 | ERROR   | [x] The closing brace for the class must have an empty line
     |         |     before it
     |         |     (Drupal.Classes.ClassDeclaration.CloseBraceAfterBody)