Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By amirn on
Hi,
I'm looking for a functionality to compare 2 entities selected from a list/table (view)
I need some guidelines about how to:
A. allow the user to select the items (entities from a view)
B. display those entities side by side for comparison
If anyone can point me in the right direction, that would be appreciated
(Drupal 9)
Comments
It sounds like you need a
It sounds like you need a custom module with JS.
The way without a custom code:
1. Create the view and select the Grid format. In the Grid options set two columns.
2. Add two exposed filters, one is needed that a user can select first entity for comparision and the secod is for the second entity. In the example below, I created the filters for Title.
3. Open the "Rearrange filter criteria" dialog and create the new filter group for "Or" operators.
The screenshots of the example:
1. https://www.drupal.org/files/entities_comparision-1.png
2. https://www.drupal.org/files/entities_comparision-2.png
3. https://www.drupal.org/files/entities_comparision-3.png
4. https://www.drupal.org/files/entities_comparision-4.png
5. https://www.drupal.org/files/entities_comparision-5.png
Thank you
thanks for your idea.
How do I select the 2 entities to be compared from my table (or grid)? is that requires JS?
Also, you may look at the
Also, you may look at the Entity Browser module. What is the real use case?
the use case
A listing page, which allows the user to select items to be compared from the entire listing (listing would be grid, list or table format)
something like this: https://www.shopping.com/search.html?keyword=phone ('add to compare' check, and a 'compare' button)
You may try the Entity
You may try the Entity comparison module.
Thank you
not sure how I've missed this module :/
seems to be very close to what I need.
Thanks!