CE output in non-default view mode is missing fields if no CE display present

Created on 29 October 2024, 25 days ago

Problem/Motivation

Given a Drupal site whose configuration for a certain entity type + bundle contains:

  • no CE displays, and
  • the default entity view display, and
  • no entity view display for a non-default view mode (e.g. "full"),

the output in that view mode should contain all fields that are enabled in the default entity view display. (This is what happens for custom_elements v2.)

Instead, we get only the non-configurable fields from a freshly initialized "full" display, i.e. title + created + uid.

  "content": {
    "element": "node-article-full",
    "title": "THE TITLE",
    "created": "1730188935",
    "uid": {
      "element": "field-entity-reference",
      "uidTargetId": "1",
      "uidEntity": {
        "element": "a",
        "href": "/user/1",
        "type": "user",
        "content": "admin"
      }
    }
  },

Steps to reproduce

The above situation applies to viewing API output of node paths (i.e. "full" view mode) on newly installed websites, e.g. the demo.

Start fresh demo site
Create node
Visit DEMO-SITE/ce-api/node/1

Proposed resolution

Read fields from the default entity view display, under these circumstances.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇳🇱Netherlands roderik Amsterdam,NL / Budapest,HU

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024