Why all the different bundle processors?

Created on 26 June 2019, over 5 years ago
Updated 27 April 2023, over 1 year ago

I was wondering why this module introduced 3 different processors that are 99% the same (only the entity name differs), and is incompatible with every other entity. Every entity in Drupal will always have a bundle; even if an entity does not define one, Drupal creates a bundle (with the same name as the entity) by default. (You can see that in the most basic EntityInterface https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityInte... which is the basis for every other entity in Drupal.)

The only reason where you might want to hide the configuration is if there is only 1 bundle, because sorting would not make sense anyway.

Aditionally I think you could use $datasource->getEntityType()->label(); to get the bundle label (eg. 'Content type' for nodes, 'Paragraphs type' for paragraphs, etc) to make the UI understandable for people who do not know what a bundle is.

IMHO this would reduce duplication and make the sort compatible with all entities.

πŸ“Œ Task
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands Neograph734 Netherlands

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡§πŸ‡ͺBelgium borisson_ Mechelen, πŸ‡§πŸ‡ͺ

    Sure, this could be a great improvement and I'm willing to accept a patch that fixes these points.

  • πŸ‡¬πŸ‡§United Kingdom andrew.farquharson

    andrew.farquharson β†’ made their first commit to this issue’s fork.

  • @andrewfarquharson opened merge request.
  • @andrewfarquharson opened merge request.
  • Status changed to Needs work over 1 year ago
  • πŸ‡³πŸ‡±Netherlands Neograph734 Netherlands

    Although this appears to be removing a lot of duplicate code, it is not solving the issue I initially described.

    I was requesting a universal entity bundle processor for every entity type. Something that should be possible with the direction given in the issue summary.

  • πŸ‡¬πŸ‡§United Kingdom andrew.farquharson

    @Neograph734 Yes, the issue is not complete which is why i have put the status to 'Needs Work'. I am using Agile approach. You or someone else can complete it. But i would say that your request for a 'Universal processor' could be opened as a new issue with that title which you have not used before, since it will involve several sub-steps to achieve. Can you please assist in closing this ticket and raising the new one with a draft of the steps required to do it.

  • πŸ‡³πŸ‡±Netherlands Neograph734 Netherlands

    Hi Andrew,

    Please realize that I created this post 4 years ago. I currently have no need for this module anymore and I don't fully remember what I thought back then.

    But yes, your steps look complete.

    if ($datasource->getEntityTypeId() == $this->entitytypeId) {
    I suppose you can skip this check to have the trait compatible with all entities.

    And I suppose you can add a new class for general entities, then have the node, and other classes extend that one for backwards compatibility. (Optionally mark them deprecated.)

    But this is all the guidance I can currently give. In comment #8 I only wanted to warn you that you should not spend a lot of time not solving the issue.
    Thanks for working on this anyway!

  • πŸ‡¬πŸ‡§United Kingdom andrew.farquharson

    Hi Neograph734, Okay thank you for the feedback! Going to have a deeper dive into the search api and where processors fit into it before attempting any MR

Production build 0.71.5 2024