I have a content entity type that uses bundle plugins (Commerce License).

I'm making a view of this entity, and I've added the bundle field, 'license type'.

The field handler works, but it outputs the machine name rather than the label of the plugin.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim created an issue. See original summary.

bojanz’s picture

Project: Entity API » Commerce Core
Version: 8.x-1.x-dev » 8.x-2.x-dev
Component: Core integration » Documentation
Parent issue: » #3097582: [meta] Rework the Commerce base field views integration

Let's fix this in Commerce first.

joachim’s picture

There's a core issue where I filed a patch for a similar problem, but with bundles that are defined in code with the bundle hook.

Which IIRC is what Entity API does, just that it sources the bundles from the plugins.

Might be worth a look?

bojanz’s picture

Indeed. Can you find the core issue?

joachim’s picture

Couldn't find it earlier, but just went and jumped through some related issues and it's this: #3056998: use the 'bundle' filter plugin for non-entity bundle fields. Though it's for the Views filter rather than field.

bojanz’s picture

Here's a patch for the field handler. We already have a fix for the filter problem.
Also took the opportunity to remove commerce_views_data_alter(), and move its overrides to CommerceEntityViewsData.

bojanz’s picture

Status: Needs review » Fixed

Committed.

  • bojanz committed 4add3ea on 8.x-2.x
    Issue #2914092 by bojanz, joachim: Views field handler for bundle field...

Status: Fixed » Closed (fixed)

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