Problem/Motivation

When attempting to add the entity usage field to the media view - /admin/content/media, the following error message is shown:

issue

It appears the entity id key is unable to be resolved as an alias, i.e. For media the id should be aliased to mid, but instead it's just id.

Steps to reproduce

- Go to view - /admin/content/media
- Add 'Entity usage field' to view
- Error displayed when attempting to preview (as attached)

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

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

mortim07 created an issue. See original summary.

mortim07’s picture

dpi’s picture

Assigned: mortim07 » dpi

Thanks, looking into this.

dpi’s picture

Title: Unable to alias entity 'id' key when adding field to view » Fix using views field with entities with id columns not named "id"

dpi’s picture

Version: 8.x-1.0 » 2.x-dev
dpi’s picture

Assigned: dpi » Unassigned
Priority: Normal » Major
Status: Active » Needs review

@mortim07 could you review the changes? including the other commits on 2.x branch to make sure the project still works for you?

mortim07’s picture

@dpi Will do!

Status: Needs review » Needs work

The last submitted patch, 2: entity_usage_views_field-unable-to-alias-id.patch, failed testing. View results

dpi’s picture

Status: Needs work » Needs review
mortim07’s picture

@dpi That branch doesn't have my patch on it.

dpi’s picture

Checkout the MR

mortim07’s picture

@dpi Yep, works perfectly now. Love the tests too! :)

  • dpi committed 8922b86 on entity_usage_views_field-3189453 authored by mortim07
    Issue #3189453 by dpi, mortim07: Fix using views field with entities...

  • dpi committed 70284ca on 2.x authored by mortim07
    Issue #3189453 by dpi, mortim07: Fix using views field with entities...
dpi’s picture

Status: Needs review » Fixed

Merged!

Status: Fixed » Closed (fixed)

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