Skip to content

Entry Title dropdown in Edit View doesn't list fields with relation type #8280

@flaki

Description

@flaki

Only normal component fields are offered in the "Configure the view" interface for providing the Entry Title, it is not possible to select relation fields which often contain the descriptive information to distinguish components, and so the editor falls back to the very non-descript "id" attribute of the component.

Looks like this issue has come up before but I don't see any solutions/workarounds shared and while there seem to be attempts to fix this for list views, I haven't found any efforts to improve on the editing experience.

Steps to reproduce the behavior

  1. Create a new content type
  2. Add a new repeatable component
  3. The component should have a relation to another content type (one-way or 1:1 relation to exactly one item)
  4. In the content type editor, click "Customize the View"
  5. On the Customize screen select "Set the component's layout" under the component with the relation field
  6. the "Entry Title" dropdown doesn't offer the relation view (or any fields on the other side of the relation)

Expected behavior
At least normal string fields on the other end of the relation should be selectable (e.g. a person relation should expose person.name as an Entry Title for a component with a person relation).

Screenshots

Only the strapi-generated unique id and the role (string) field can be selected as "Entry Title", but those are not useful, a person.name on the other end of the relation is a descriptive field of the component, the ID is opaque, while role can be the same across instances of the component (or, in this case, even empty for "default" roles).

Screenshot from 2020-10-11 15-24-10

The people-involved component type:

Screenshot_2020-10-11 Strapi - Content Type Builder

Code snippets

The people-involved model descriptor:

{
  "collectionName": "components_people_people_involveds",
  "info": {
    "name": "people involved",
    "icon": "user-friends"
  },
  "options": {},
  "attributes": {
    "person": {
      "model": "people"
    },
    "role": {
      "type": "string"
    }
  }
}

The people collection type on the other end of the relation:

{
  "kind": "collectionType",
  "collectionName": "people",
  "info": {
    "name": "People"
  },
  "options": {
    "increments": true,
    "timestamps": true
  },
  "attributes": {
    "name": {
      "type": "string"
    },
    "email": {
      "type": "email"
    },
    "bio": {
      "type": "text"
    },
    "photo": {
      "model": "file",
      "via": "related",
      "allowedTypes": [
        "images",
        "files",
        "videos"
      ],
      "plugin": "upload",
      "required": false
    },
    "identities": {
      "type": "component",
      "repeatable": true,
      "component": "people.identity"
    }
  }
}

System

  • Node.js version: v12.18.4
  • NPM version: v12.18.4
  • Strapi version: 3.1.4
  • Database: postgres
  • Operating system: Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-26-generic x86_64)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions