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
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | generic_entity_bundle_field-2363811-6.patch | 41.78 KB | JulienD |
| #2 | drupal-2363811-2.patch | 4.92 KB | michaellenahan |
Comments
Comment #1
michaellenahan commentedComment #2
michaellenahan commentedI'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.
Comment #3
michaellenahan commentedComment #4
michaellenahan commented@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?
Comment #5
dawehnerYeah exactly.
Comment #6
JulienD commentedI'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.
Comment #7
jibranComment #8
jibranIs this same as #2322949: Implement generic entity link view field handlers?
Comment #11
dawehner@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).
Comment #12
JulienD commented@dawehner could you confirm that working on this issue make sens ?
Comment #13
dawehnerYeah, so this issue would be just about the Bundle.php, and the other issue would contain all other link field handlers.
Comment #14
bojanz commenteddawehner says this is fixed already, because we now use formatter based rendering and we use the entity reference formatters.