Add the ID field formatter

Created on 14 January 2025, 3 months ago

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

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡«Afghanistan ab.shakir

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

Merge Requests

Comments & Activities

  • Issue created by @ab.shakir
  • Merge request !65Add the ID field formatter β†’ (Open) created by Unnamed author
  • Pipeline finished with Success
    3 months ago
    Total: 234s
    #395159
  • πŸ‡¦πŸ‡«Afghanistan ab.shakir
  • πŸ‡ΊπŸ‡ΈUnited States trackleft2 Tucson, AZ πŸ‡ΊπŸ‡Έ

    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)
    
    
Production build 0.71.5 2024