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.
We use hook_entity_base_field_info_alter() and hook_entity_bundle_field_info_alter() to alter a entity_reference field's handle, so that we can restrict the selection results.
$fields['field_store']->setSetting('handler', 'custom:group_commerce_store');
But it don't take effect after change field's form widget to select2boxes_autocomplete_multi
These days we give up custom EntityReferenceSelection and use custom Entity Reference views filter instead.
Like this:
When we change to Select2 boxes (Multiple values), Everything works fine ,
But After we enable pre-loaded entries,The Entity Reference views filter lose efficacy
Comment | File | Size | Author |
---|---|---|---|
#7 | pre.png | 73.58 KB | lawxen |
#7 | vrfb.png | 187.63 KB | lawxen |
#6 | interdiff-2980469-5-6.txt | 2.22 KB | lawxen |
#6 | 2980469-6.patch | 5.22 KB | lawxen |
| |||
#5 | 2980469-5.patch | 4.73 KB | lawxen |
|
Comments
Comment #2
lawxen CreditAttribution: lawxen at Sparkpad commentedComment #3
matsbla CreditAttribution: matsbla commentedThanks for reporting the issue, please give feedback if you find a way to solve it!
Comment #4
lawxen CreditAttribution: lawxen at Sparkpad commentedComment #5
lawxen CreditAttribution: lawxen at Sparkpad commentedThis patch fix all the bugs described in the issue summary no mater which "reference method" we use(custom handler): custom entityRefernce views filter or custom entityRefernceSelection.
Comment #6
lawxen CreditAttribution: lawxen at Sparkpad commentedJust coding standards optimization and change a comment
NO functional change
Comment #7
lawxen CreditAttribution: lawxen at Sparkpad commentedComment #8
Valentine94Thanks, caseylau, patch looks really nice to me
I've applied it and tested locally - everything looks good.
So I don't see any reason to not mark it RTBC and commit asap
Comment #10
matsbla CreditAttribution: matsbla commentedThanks a lot for that!
Comment #11
matsbla CreditAttribution: matsbla commented