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.
Extend the entity reference views filter with the ability to sort the referenced options based on the selected bundle field.
Requested feature: Generalize TaxonomyIndexTid filter to be available for all entity reference fields (2429699) #65
Comment | File | Size | Author |
---|---|---|---|
#15 | views2.png | 38 KB | sanjayk |
#15 | views1.png | 90.72 KB | sanjayk |
#4 | interdiff-2870766-2-4.txt | 1.09 KB | akozma |
#4 | entity_reference_view_filter_sort_options-2870766-4.patch | 4.58 KB | akozma |
#2 | entity_reference_view_filter_sort_options-2870766-2.patch | 5.5 KB | akozma |
Comments
Comment #2
akozma CreditAttribution: akozma commentedThe patch allows to order the filter values based on the selected bundle field.
However there's an issue as the already sorted results are grouped by bundle in the selection plugin callback
See
\Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::getReferenceableEntities()
Comment #3
akozma CreditAttribution: akozma commentedComment #4
akozma CreditAttribution: akozma commentedFixes the coding standard, indentation.
Comment #5
joelpittetComment #14
jonathanshawComment #15
sanjayk CreditAttribution: sanjayk as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedIn order to recreate i have used basic page and article content type for which had added a reference field from Basic content type into Article content type.
Added three nodes for Article and two for Basic page.
Basic page nodes: node/1, node/4
Article nodes: node/2, node/3, node/5
Following Basic page nodes are referenced in Article nodes
node/2 => node/1
node/3 => node/1
node/5 => node/4
based on these content I had configured a view to recreate the scenario, I find this to be working as expected. Attaching screenshot of the view and its settings for reference.
Comment #16
sanjayk CreditAttribution: sanjayk as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedComment #17
jonathanshawNeeds work for reroll and #2
Comment #24
manishsaharan CreditAttribution: manishsaharan at Specbee commented#2 can't be re-rolled since there is no such file views/src/Plugin/views/filter/EntityReference.php present in d10.