Problem/Motivation

We want Views to provide other modules with a generic way to:
- Link to an entity view
- Link to an entity edit form
- Link to an entity delete form

Currently, this is being done by modules themselves.

For example, Comment module provides a LinkEdit and a LinkDelete.

It would be better if Views provided this functionality in generic classes, which other modules can extend if they wish.

Proposed resolution

A start has already been made on this, here: https://www.drupal.org/files/issues/2322949-4.patch

Remaining tasks

User interface changes

API changes

Original report by dawehner

Problem/Motivation

Contrib module authors should have an easy time to provide a bundle field in views.

Proposed resolution

Provide one, ... most of the code is already part of https://www.drupal.org/files/issues/2322949-4.patch

Remaining tasks

  • Take the existing patch
  • Extract everything which is related with the bundle field
  • Extract the tests and write a proper integration test.

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

michaellenahan’s picture

Assigned: Unassigned » michaellenahan
michaellenahan’s picture

FileSize
4.92 KB

I'm taking this slowly, so I can understand what I'm doing with each step.

So this is the first step.
This patch creates an EntityLink class which can be used by node and other modules.
Now, Drupal\node\Plugin\views\field\Node extends EntityLink instead of FieldPluginBase.

I tested this with the admin/content view.

I found that I had to include the query() method in order to have the Title and Content Type show up at admin/content.
Not sure why, I think it was to do with the displaying the labels of these entities.

michaellenahan’s picture

Issue summary: View changes
michaellenahan’s picture

@dawehner I was reading through https://www.drupal.org/node/2322949 and I think I might have misunderstood what this current ticket is for.

"OKay sure, let's remove the bundle field for now"

I think I need to concentrate on this part then.
+++ b/core/modules/views/src/Plugin/views/field/Bundle.php

Is that correct?

dawehner’s picture

I think I need to concentrate on this part then.
+++ b/core/modules/views/src/Plugin/views/field/Bundle.php

Is that correct?

Yeah exactly.

JulienD’s picture

Assigned: michaellenahan » Unassigned
Status: Active » Needs work
FileSize
41.78 KB

I've rerolled the patch given in the main topic and I've kept most of everything. Maybe there is too much.

I've added Taxonomy term to the list of entity types that should implement this patch.

Remaining tasks
* Write a proper integration test.

jibran’s picture

Status: Needs work » Needs review
jibran’s picture

Status: Needs review » Needs work

The last submitted patch, 6: generic_entity_bundle_field-2363811-6.patch, failed testing.

The last submitted patch, 2: drupal-2363811-2.patch, failed testing.

dawehner’s picture

@jibran
This one is about just getting the entity bundle field, the other ones introduces a lot of more other fields. (at least this was the plan when it got split up).

JulienD’s picture

@dawehner could you confirm that working on this issue make sens ?

dawehner’s picture

@dawehner could you confirm that working on this issue make sens ?

Yeah, so this issue would be just about the Bundle.php, and the other issue would contain all other link field handlers.

bojanz’s picture

Status: Needs work » Closed (duplicate)

dawehner says this is fixed already, because we now use formatter based rendering and we use the entity reference formatters.