Problem/Motivation

When an entity is being diagrammed, and has an entity reference using a View filter, the reference is not drawn or shown at all.
The difficulty is that the field does not know what entity or bundles are being surfaced by the View.

There was already an issue created https://www.drupal.org/project/content_model_documentation/issues/3343244 but this didn't cover all entity types.

Steps to reproduce

Dig into the View and try to surface what entity type and bundle(s) are being surfaced by the View.

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

mibfire created an issue. See original summary.

mibfire’s picture

I created a patch to fix this properly.

swirt made their first commit to this issue’s fork.

swirt’s picture

Thank you for creating this issue and getting a patch submitted so rapidly.
I took the patch and created a MR from it. So scan's and linting would run.

swirt’s picture

Priority: Major » Normal
Status: Active » Needs work
mibfire’s picture

@swirt

My bad. I will fix this.

mibfire’s picture

@swirt

Actually this is not just my fault. This RelatedEntities class should have been a service. Could you pls transform RelatedEntities class to a service?

mibfire’s picture

@swirt

Or may i make this service? That is also fine for me.

swirt’s picture

Thanks mibfire. I'll look at this closer in the next couple days. i'm not sure if this needs to be a service or not. I need to spend some time looking at it. It's been too long since I wrote it 😀

mibfire’s picture

@swirt

Np, either way i think we should not create object directly calling the class and instantiating it. Either this should be a service as i said or we should use the

Drupal::service('class_resolver')

to be able to use DI, this way we could extend the RelatedEntities class with ContainerInjectionInterface. So in this case we could set in the RelatedEntities class itself how and with what services the RelatedEntities class can be instantiated by default.

Ok, pls take a look at this and tell me if you can do this or i can take over this task from you.

Thanks

swirt’s picture

@mibfire I have taken this as far as I can tonight. (I need sleep). If you can spot the problem, feel free to add commits. I won't be touching it for another 24 hours.

swirt’s picture

$references['target_bundles'] ends up as an empty array for both the user View and the Term view.

mibfire’s picture

@swirt

I will check this shortly, but i know my patch works flawlessly because i have created tons of diagrams with it so far, and it includes all types of entities with views reference.

swirt’s picture

I think I figured out one of the problems. It is unrelated to this MR. entitiy reference to User entities are not referenced in this diagram at all.
I created a separate issue #3560618: Entity reference to users from content entities are not shown on the diagram.

  • swirt committed 18edb156 on 1.0.x
    fix: #3559421 Entity diagram: An entity reference using a View filter is...
swirt’s picture

Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

swirt’s picture

Status: Fixed » Closed (fixed)

This was released as 1.0.37

Thank you again @mibfire for all you work on this.

mibfire’s picture

@swirt

I would have checked this, but you were faster. Thank you too for the new service, the fine tuning & polishing and the credit. :)