| #547 | 2429699-546-10.4.x.patch | 3.37 KB | ngal |
| #545 | 2429699-546-10.3.x.patch | 50.69 KB | biancaradu27 |
| #523 | interdiff 521-2429699-entity-reference-views-filter-d101.txt | 11.16 KB | graber |
| #521 | drupal-views-entity-reference-filter-2429699-521.patch | 2.67 KB | medha kumari |
| #519 | interdiff_510-519.txt | 1.2 KB | daniel.rolls@flightcentre.com.au |
| #519 | drupal-views-entity-reference-filter-2429699-519.patch | 66.51 KB | daniel.rolls@flightcentre.com.au |
| #510 | interdiff_491-510.txt | 1.01 KB | muriqui |
| #510 | drupal-views-entity-reference-filter-2429699-510.patch | 66.47 KB | muriqui |
| #502 | interdiff_491-502.txt | 61.79 KB | asad_ahmed |
| #502 | 2429699-502.patch | 2.67 KB | asad_ahmed |
| #491 | interdiff-2429699-488-491.txt | 1.85 KB | scott_euser |
| #491 | drupal-views-entity-reference-filter-2429699-491.patch | 66.22 KB | scott_euser |
| #491 | 2022-07-25_20-22.png | 160.81 KB | scott_euser |
| #488 | interdiff-2429699-487-488.txt | 3.2 KB | scott_euser |
| #488 | drupal-views-entity-reference-filter-2429699-488.patch | 66.34 KB | scott_euser |
| #487 | interdiff-2429699-486-487.txt | 2.4 KB | scott_euser |
| #487 | drupal-views-entity-reference-filter-2429699-487.patch | 66.6 KB | scott_euser |
| #486 | drupal-views-entity-reference-filter-2429699-486.patch | 66.78 KB | scott_euser |
| #486 | interdiff-2429699-476-486.txt | 50.27 KB | scott_euser |
| #483 | drupal-views-entity-reference-filter-2429699-483.patch | 49.66 KB | akalam |
| #476 | interdiff-2429699-473-476.txt | 3 KB | scott_euser |
| #476 | drupal-views-entity-reference-filter-2429699-476.patch | 46.74 KB | scott_euser |
| #473 | interdiff-2429699-471-473.txt | 565 bytes | scott_euser |
| #473 | drupal-views-entity-reference-filter-2429699-473.patch | 47.1 KB | scott_euser |
| #471 | drupal-views-entity-reference-filter-2429699-471.patch | 47.88 KB | scott_euser |
| #471 | interdiff-2429699-470-471.txt | 741 bytes | scott_euser |
| #470 | update-hook-2429699-comment-470-onwards-add-to-your-own-module.txt | 1.61 KB | scott_euser |
| #470 | 2022-04-07_07-54.png | 46.09 KB | scott_euser |
| #470 | interdiff-2429699-453-470.txt | 4.25 KB | scott_euser |
| #470 | drupal-views-entity-reference-filter-2429699-470.patch | 48.84 KB | scott_euser |
| #453 | 2429699-453-9.3.x.patch | 49.1 KB | seanb |
| #452 | interdiff-2429699-439-446.txt | 14.28 KB | micnap |
| #446 | 2429699-446.patch | 54.79 KB | catch |
| #439 | 2429699-439.patch | 48.91 KB | ldavidsp |
| #436 | 2429699-436.patch | 2.96 KB | ldavidsp |
| #435 | 2429699-435.patch | 2.96 KB | ldavidsp |
| #429 | interdiff-2429699-427-429.txt | 1.36 KB | yogeshmpawar |
| #429 | 2429699-429.patch | 54.79 KB | yogeshmpawar |
| #427 | interdiff-2429699-424-427.txt | 1.9 KB | yogeshmpawar |
| #427 | 2429699-427.patch | 54.79 KB | yogeshmpawar |
| #424 | reroll_diff_2429699_421-424.txt | 3.08 KB | ankithashetty |
| #424 | 2429699-424.patch | 50 KB | ankithashetty |
| #421 | 2429699-421.patch | 49.96 KB | nickdickinsonwilde |
| #420 | 2429699-420.patch | 50.08 KB | catch |
| #419 | 2429699-419.patch | 49.71 KB | catch |
| #418 | 2429699-418-with-term-reference-fields.patch | 78.28 KB | nixou |
| #414 | 2429699-414.patch | 49.71 KB | klaasvw |
| #413 | 2429699-9.1-413.patch | 49.69 KB | willpeps |
| #409 | 2429699-9.1-409.patch | 49.69 KB | jacobbell84 |
| #404 | interdiff.txt | 542 bytes | kapilv |
| #404 | 2429699-404.patch | 49.71 KB | kapilv |
| #401 | 2429699-9.2-400.patch | 49.71 KB | mr.york |
| #401 | 2429699-9.1-400.patch | 56.15 KB | mr.york |
| #400 | 2429699-8.9.x-399.patch | 49.62 KB | mr.york |
| #399 | interdiff-393-399.txt | 974 bytes | mr.york |
| #399 | 2429699-8.9.x-399.patch | 52.91 KB | mr.york |
| #398 | 2429699-8.9.x-398.patch | 49.44 KB | mr.york |
| #397 | interdiff-393-397.txt | 974 bytes | mr.york |
| #397 | 2429699-8.9.x-397.patch | 49.53 KB | mr.york |
| #393 | 2429699-8.9.x-392.patch | 53.62 KB | luksak |
| #392 | 2429699-8.9.x-392.patch | 0 bytes | luksak |
| #391 | Screenshot from 2021-04-07 16-06-02.png | 41.73 KB | yepa |
| #389 | interdiff-387-389.txt | 542 bytes | sokru |
| #389 | 2429699-389.patch | 48.91 KB | sokru |
| #387 | interdiff-MR18-387.txt | 2.6 KB | sokru |
| #387 | 2429699-387.patch | 48.91 KB | sokru |
| #385 | 2429699-8.9.x-385.patch | 53.55 KB | a.dmitriiev |
| #382 | core-2429699-views_er_filter-382.patch | 48.76 KB | czigor |
| #379 | screenshot-drupal9.ddev_.site-2020.11.28-07_23_57.png | 114.71 KB | scott_euser |
| #371 | interdiff_369-371.txt | 1.4 KB | klaasvw |
| #371 | 2429699-371--on-9_0_x.do-not-test.patch | 47.24 KB | klaasvw |
| #371 | drupal-views-entity-reference-filter-2429699-371.patch | 47.22 KB | klaasvw |
| #369 | drupal-views-entity-reference-filter-2429699-369.patch | 46.34 KB | scott_euser |
| #369 | interdiff-2429699-368-369.txt | 5.63 KB | scott_euser |
| #368 | interdiff-2429699-366-368.txt | 1.65 KB | scott_euser |
| #368 | drupal-views-entity-reference-filter-2429699-368.patch | 40.53 KB | scott_euser |
| #367 | interdiff-2429699-364-366.txt | 58.87 KB | scott_euser |
| #367 | interdiff-2429699-351-366.txt | 28.76 KB | scott_euser |
| #367 | drupal-views-entity-reference-filter-2429699-366.patch | 40.48 KB | scott_euser |
| #364 | interdiff_362_364.txt | 27.44 KB | anmolgoyal74 |
| #364 | 2429699-364.patch | 63.51 KB | anmolgoyal74 |
| #362 | interdiff_361_362.txt | 53.92 KB | kapilv |
| #362 | 2429699-362.patch | 36.35 KB | kapilv |
| #361 | drupal-generalize-taxonomyindextid-filter-2429699-301.patch | 77.87 KB | nono95230 |
| #354 | 2429699-354--on-8_9_x.do-not-test.patch | 45.02 KB | mparker17 |
| #354 | 2429699-354--on-9_0_x.do-not-test.patch | 45.02 KB | mparker17 |
| #354 | 2429699-354--on-9_1_x.patch | 45.05 KB | mparker17 |
| #354 | interdiff--251-254.txt | 1.48 KB | mparker17 |
| #351 | 2429699-351--on-9_1_x.patch | 44.61 KB | mparker17 |
| #351 | 2429699-351--on-9_0_x.do-not-test.patch | 44.59 KB | mparker17 |
| #351 | 2429699-351--on-8_9_x.do-not-test.patch | 44.59 KB | mparker17 |
| #334 | 2429699-334.patch | 43.7 KB | krzysztof domański |
| #325 | drupal-generalize-taxonomyindextid-filter-2429699-325.patch | 43.7 KB | scott_euser |
| #325 | interdiff-2429699-323-325.txt | 621 bytes | scott_euser |
| #323 | interdiff-2429699-311-323.txt | 6.9 KB | scott_euser |
| #323 | drupal-generalize-taxonomyindextid-filter-2429699-323.patch | 43.69 KB | scott_euser |
| #311 | interdiff-2429699-297-311.txt | 837 bytes | murz |
| #311 | drupal-generalize-taxonomyindextid-filter-2429699-311.patch | 44.55 KB | murz |
| #297 | interdiff-2429699-295-297.txt | 887 bytes | scott_euser |
| #297 | drupal-generalize-taxonomyindextid-filter-2429699-297.patch | 44.58 KB | scott_euser |
| #295 | interdiff-2429699-277-295.txt | 28.52 KB | scott_euser |
| #295 | drupal-generalize-taxonomyindextid-filter-2429699-295.patch | 45.7 KB | scott_euser |
| #294 | interdiff_267-277.txt | 301 bytes | Mokshit06 |
| #293 | interdiff_276-277.txt | 79.29 KB | Mokshit06 |
| #292 | filter-select-list-for-entity-reference-field.jpg | 14.45 KB | scott_euser |
| #292 | filter-text-field-for-entity-reference-field.jpg | 13.58 KB | scott_euser |
| #292 | verf-entity-reference-filter.png | 45.77 KB | scott_euser |
| #292 | selection-type.png | 4.28 KB | scott_euser |
| #277 | drupal-generalize-taxonomyindextid-filter-2429699-277.patch | 77.07 KB | scott_euser |
| #277 | interdiff-2429699-276-277.txt | 301 bytes | scott_euser |
| #277 | interdiff-2429699-271-277.txt | 879 bytes | scott_euser |
| #276 | interdiff-2429699-271-276.txt | 904 bytes | mdolnik |
| #276 | drupal-generalize-taxonomyindextid-filter-2429699-276.patch | 77.07 KB | mdolnik |
| #272 | interdiff-2429699-267-271.txt | 583 bytes | scott_euser |
| #272 | drupal-generalize-taxonomyindextid-filter-2429699-271.D8.patch | 76.92 KB | scott_euser |
| #267 | interdiff-2429699-263-267.txt | 17.39 KB | scott_euser |
| #267 | drupal-generalize-taxonomyindextid-filter-2429699-267.D8.patch | 76.93 KB | scott_euser |
| #263 | drupal-n2429699-263-88x.patch | 66.67 KB | kasey_mk |
| #262 | drupal-n2429699-262-88x.patch | 33.99 KB | kasey_mk |
| #255 | Screen Shot 2019-12-09 at 11.32.47 AM.png | 49.54 KB | superfluousapostrophe |
| #253 | 2429699-253.patch | 72.98 KB | heddn |
| #240 | drupal-n2429699-232-87x.patch | 66.62 KB | _Archy_ |
| #232 | drupal-n2429699-232-87x.patch | 66.62 KB | damienmckenna |
| #231 | drupal-n2429699-214-225.interdiff.txt | 13.84 KB | damienmckenna |
| #225 | generic_entityreference_filter_2429699-225.patch | 72.89 KB | _Archy_ |
| #225 | interdiff-223-225.txt | 8.08 KB | _Archy_ |
| #223 | generic_entityreference_filter_2429699-223.patch | 76.14 KB | _Archy_ |
| #223 | interdiff-219-223.txt | 4.17 KB | _Archy_ |
| #219 | generic_entityreference_filter_2429699-219.patch | 75.99 KB | _Archy_ |
| #219 | interdiff-212-219.txt | 3.85 KB | _Archy_ |
| #214 | drupal-n2429699-212-877.patch | 64.91 KB | damienmckenna |
| #212 | drupal-n2429699-212.patch | 71.32 KB | damienmckenna |
| #206 | generic_entityreference_filter_2429699-206-reroll-8.7.x.patch | 71.23 KB | nuez |
| #204 | generic_entityreference_filter_2429699-204-reroll-8.7.x.patch | 71.23 KB | nuez |
| #199 | 2429699_196-199_interdiff.txt | 1.56 KB | pancho |
| #199 | generic_entityreference_filter_2429699-199.patch | 71.24 KB | pancho |
| #196 | 2429699_194-196_interdiff.diff | 13.11 KB | pancho |
| #196 | generic_entityreference_filter_2429699-196.patch | 71.13 KB | pancho |
| #194 | 2429699_191-194_interdiff.diff | 2.21 KB | pancho |
| #194 | generic_entityreference_filter_2429699-194.patch | 69.66 KB | pancho |
| #191 | 2429699_190-191_interdiff.txt | 25.81 KB | pancho |
| #191 | generic_entityreference_filter_2429699-191.patch | 69.47 KB | pancho |
| #190 | 2429699_186_190_interdiff.txt | 1.1 KB | pancho |
| #190 | generic_entityreference_filter_2429699_190.patch | 67.98 KB | pancho |
| #187 | generic_entityreference_filter_2429699-186.patch | 67.86 KB | _Archy_ |
| #187 | 2429699_184-186_interdiff.txt | 10.65 KB | _Archy_ |
| #184 | generic_entityreference_filter_2429699-184.patch | 65.13 KB | _Archy_ |
| #184 | 2429699_182-184_interdiff.txt | 4.6 KB | _Archy_ |
| #184 | screenshot-drupal-dev.lndo_.site-2019.06.13-15-16-44.png | 20.61 KB | _Archy_ |
| #184 | screenshot-drupal-dev.lndo_.site-2019.06.13-15-17-40.png | 35.4 KB | _Archy_ |
| #184 | screenshot-drupal-dev.lndo_.site-2019.06.13-15-19-23.png | 12.33 KB | _Archy_ |
| #184 | screenshot-drupal-dev.lndo_.site-2019.06.13-15-14-22.png | 7.63 KB | _Archy_ |
| #182 | 2429699_181-182_interdiff.txt | 11.53 KB | _Archy_ |
| #182 | generic_entityreference_filter_2429699-182.patch | 64.83 KB | _Archy_ |
| #181 | 2429699_180-181_interdiff.txt | 6.56 KB | pancho |
| #181 | generic_entityreference_filter_2429699-181.patch | 62.64 KB | pancho |
| #180 | 2429699_179-180_interdiff.txt | 4.45 KB | pancho |
| #180 | generic_entityreference_filter_2429699-180.patch | 62.56 KB | pancho |
| #179 | 2429699_178-179_interdiff.txt | 8.69 KB | pancho |
| #179 | generic_entityreference_filter_2429699-179.patch | 62.33 KB | pancho |
| #178 | 2429699_177-178_interdiff.txt | 848 bytes | pancho |
| #178 | generic_entityreference_filter_2429699-178.patch | 61.78 KB | pancho |
| #177 | generic_entityreference_filter_2429699-177.patch | 61.61 KB | pancho |
| #167 | 22429699-148_162.interdiff.txt | 610 bytes | dww |
| #162 | generic_entityreference_filter_22429699-162.patch | 61.6 KB | oriol_e9g |
| #159 | generic_entityreference_filter_22429699-159.patch | 30.07 KB | oriol_e9g |
| #148 | generic_entityreference_filter_22429699-148.patch | 61.6 KB | pancho |
| #148 | 22429699_147-148_interdiff.txt | 2.08 KB | pancho |
| D7_entity_reference___Site-Install.png | 114.61 KB | jhedstrom |
| Entity_reference_exposed_filter__Content____Site-Install.png | 162.37 KB | jhedstrom |
| #2 | entity-reference-exposed-filters-2429699-02.patch | 6.25 KB | jhedstrom |
| #10 | Content Content Site-Install.png | 31.24 KB | berdir |
| #17 | interdiff.txt | 18.82 KB | jhedstrom |
| #17 | entity-reference-exposed-filters-2429699-17.patch | 20.61 KB | jhedstrom |
| #24 | interdiff.txt | 1.09 KB | jhedstrom |
| #24 | entity-reference-exposed-filters-2429699-24.patch | 20.62 KB | jhedstrom |
| #34 | entity-reference-exposed-filters-2429699-34.patch | 18.67 KB | taran2l |
| #36 | entity-reference-exposed-filters-2429699-36.patch | 19.98 KB | taran2l |
| #39 | entity-reference-exposed-filters-2429699-36-39-interdiff.txt | 1.67 KB | jsst |
| #39 | entity-reference-exposed-filters-2429699-39.patch | 20.2 KB | jsst |
| #45 | interdiff-45-39.txt | 16.4 KB | _Archy_ |
| #45 | entity_reference_view_filter-2429699-45.patch | 17.2 KB | _Archy_ |
| #47 | entity_reference_view_filter-2429699-47.patch | 27.02 KB | _Archy_ |
| #50 | interdiff-47-50.txt | 7.94 KB | _Archy_ |
| #50 | entity_reference_view_filter-2429699-50.patch | 27.96 KB | _Archy_ |
| #52 | interdiff-50-52.txt | 800 bytes | _Archy_ |
| #52 | entity_reference_view_filter-2429699-52.patch | 28.22 KB | _Archy_ |
| #55 | entity_reference_view_filter-2429699-55-D8-2.patch | 3.6 KB | _Archy_ |
| #56 | entity_reference_view_filter-2429699-56-D8-2.patch | 28.01 KB | _Archy_ |
| #59 | entity_reference_view_filter-2429699-59.patch | 27.27 KB | _Archy_ |
| #59 | interdiff-56-59.txt | 17.6 KB | _Archy_ |
| #60 | entity_reference_view_filter-2429699-60-D8-2-x.patch | 27.27 KB | _Archy_ |
| #63 | interdiff-59-63.txt | 1.73 KB | _Archy_ |
| #63 | entity_reference_view_filter-2429699-63.patch | 27.41 KB | _Archy_ |
| #63 | entity_reference_view_filter-2429699-63-D8-2-x.patch | 27.41 KB | _Archy_ |
| #70 | entity_reference_view_filter-2429699-70.patch | 27.45 KB | das-peter |
| #70 | interdiff-2429699-63-70.diff | 814 bytes | das-peter |
| #74 | 2429699-74-content.png | 39.78 KB | leksat |
| #74 | 2429699-74-view.png | 248.73 KB | leksat |
| #81 | interdiff-70-81.txt | 16.36 KB | _Archy_ |
| #81 | entity_reference_view_filter-2429699-81.patch | 31.97 KB | _Archy_ |
| #87 | entity_reference_view_filter-2429699-87.patch | 32.64 KB | luksak |
| #87 | interdiff.txt | 4.43 KB | luksak |
| #92 | 2429699-92.patch | 32.67 KB | seanb |
| #92 | interdiff-87-92.txt | 717 bytes | seanb |
| #99 | views-entityreference-filter-2429699-99.patch | 32.62 KB | ckaotik |
| #99 | interdiff-2429699-92-99.txt | 7.26 KB | ckaotik |
| #104 | views-entityreference-filter-selection-2429699-104-interdiff.txt | 8.15 KB | berdir |
| #104 | Selection_277.png | 30.53 KB | berdir |
| #107 | 2429699-107.patch | 35.94 KB | rosk0 |
| #107 | 2429699-interdiff-99-107.txt | 145 bytes | rosk0 |
| #107 | 2429699-interdiff-104-107.txt | 0 bytes | rosk0 |
| #108 | 2429699-interdiff-99-107.txt | 13.46 KB | rosk0 |
| #108 | 2429699-interdiff-104-107.txt | 10.66 KB | rosk0 |
| #111 | 2429699-111.patch | 38.03 KB | rosk0 |
| #111 | 2429699-107-111-interdiff.txt | 21.61 KB | rosk0 |
| #114 | 22429699-114.patch | 32.56 KB | rlmumford |
| #114 | interdiff.txt | 12.95 KB | rlmumford |
| #119 | 22429699-114-119_interdiff.txt | 3.66 KB | pancho |
| #119 | generic_entityreference_filter_22429699-119.patch | 31.92 KB | pancho |
| #121 | 22429699-114-121_interdiff.txt | 6.82 KB | pancho |
| #121 | 22429699-119-121_interdiff.txt | 4.43 KB | pancho |
| #121 | generic_entityreference_filter_22429699-121.patch | 31.9 KB | pancho |
| #123 | 22429699-114-123_interdiff.txt | 7.96 KB | pancho |
| #123 | 22429699-121-123_interdiff.txt | 1.61 KB | pancho |
| #123 | generic_entityreference_filter_22429699-123.patch | 32.49 KB | pancho |
| #124 | filter groups.mkv | 247.84 KB | pancho |
| #125 | configure_filter.mkv | 194.05 KB | pancho |
| #126 | 22429699-114-126_interdiff.patch | 8.79 KB | pancho |
| #126 | 22429699-123-126_interdiff.patch | 854 bytes | pancho |
| #126 | generic_entityreference_filter_22429699-126.patch | 33.49 KB | pancho |
| #128 | 22429699-114-128_interdiff.txt | 9.33 KB | pancho |
| #128 | 22429699-126-128_interdiff.txt | 2.95 KB | pancho |
| #128 | generic_entityreference_filter_22429699-128.patch | 33.8 KB | pancho |
| #130 | 22429699-114-130_interdiff.txt | 9.65 KB | pancho |
| #130 | 22429699-128-130_interdiff.txt | 633 bytes | pancho |
| #130 | generic_entityreference_filter_22429699-130.patch | 33.8 KB | pancho |
| #131 | 22429699-114-131_interdiff.txt | 25.6 KB | pancho |
| #131 | 22429699-130-131_interdiff.txt | 16.22 KB | pancho |
| #131 | generic_entityreference_filter_22429699-131.patch | 49.78 KB | pancho |
| #133 | 22429699-114-133_interdiff.txt | 27.16 KB | pancho |
| #133 | 22429699-131-133_interdiff.txt | 3.16 KB | pancho |
| #133 | generic_entityreference_filter_22429699-133.patch | 50.54 KB | pancho |
| #135 | 22429699-114-135_interdiff.txt | 38.16 KB | pancho |
| #135 | 22429699-133-135_interdiff.txt | 13.52 KB | pancho |
| #135 | generic_entityreference_filter_22429699-135.patch | 56.9 KB | pancho |
| #137 | 22429699-114-137_interdiff.txt | 38.12 KB | pancho |
| #137 | 22429699-135-137_interdiff.txt | 609 bytes | pancho |
| #137 | generic_entityreference_filter_22429699-137.patch | 56.9 KB | pancho |
| #139 | 22429699-114-139_interdiff.txt | 38.78 KB | pancho |
| #139 | 22429699-137-139_interdiff.txt | 2.7 KB | pancho |
| #139 | generic_entityreference_filter_22429699-139.patch | 57.73 KB | pancho |
| #141 | 22429699-114-141_interdiff.txt | 42.76 KB | pancho |
| #141 | 22429699-139-141_interdiff.txt | 4.86 KB | pancho |
| #141 | generic_entityreference_filter_22429699-141.patch | 61.63 KB | pancho |
| #147 | 22429699_141-147_diff.txt | 2 KB | pancho |
| #147 | generic_entityreference_filter_22429699-147.patch | 61.67 KB | pancho |
Comments
Comment #1
geertvd commentedI'll have a crack at this.
Comment #2
jhedstrom@geertvd here's a very rough start that will hopefully be of some use.
Comment #3
jhedstromOops, that was defaulted to TRUE for debugging...should be FALSE.
Comment #4
geertvd commentedI'm a bit lost with this one but maybe these comments are useful.
I thought we could use
FieldAPIHandlerTraitfor that which has a methodgetFieldDefinitionbut it seems this object is not complete enough to get the selectionHandler.I also wonder how this should behave. in D7 "target bundles" is a field setting but now it seems this it's a field instance setting.
Comment #5
jhedstromOh cool, I didn't know about
FieldAPIHandlerTrait, that looks promising. However, as you note, the fact that target bundles now reside at the field setting level is going to be problematic here.Comment #6
yched commented"target bundles" : see #2064191: Fix the 'target_bundle' field setting - 'target_bundles' are not validated when entity_reference is enabled
Comment #7
jhedstromComment #8
xjmThis seems like a feature request to me, not a bug? It's okay not to have feature parity with D7 contrib modules. Views doesn't either.
Comment #9
berdirThe point is that you can do that with taxonomy term references*. And we want to replace them with ER, so we lose that feature, and I think this is important.
We also had criticals around the regression that it was not possible to expose list fields as exposed filter, nobody there said that's not a regression because views was contrib in 7.x :)
* Not in the same way, instead, the filter plugin asks you if you want autocomplete or a select. That seems actually like the preferred option to me?
Comment #10
berdirThis is what I was talking about:
Shouldn't we just port this behavior to the entity reference filter plugin, no need to make it configurable per field type?
Comment #11
xjmSo see #1847596-223: Remove Taxonomy term reference field in favor of Entity reference from @berdir. For taxonomy, there will be no change. I think it's acceptable for core to ship without this feature of D7 entity reference, and so I think that makes this issue a feature request (and therefore targeted for 8.1.x or later if we do decide to add it to core). If there are other regressions please add more detail here. Thanks!
Comment #12
jhedstromIf core ships with this as is, even contrib will not be able to replace the functionality without swapping out the entity reference field type. As long as bundle settings live with the field config, rather than the storage settings, views can't narrow the items down below entity type (eg, all nodes).
As far as this being a feature request, I think this will be seen as a major regression when folks have been told entity reference has been moved to core.
Comment #13
berdirI'm confused, what does that have to do with this issue?
Comment #14
jhedstromFollowed up with Berdir in IRC to clarify:
Comment #15
yched commentedThe 'target_bundle' setting is a red herring, it is not used by anything anymore - see #2064191-4: Fix the 'target_bundle' field setting - 'target_bundles' are not validated when entity_reference is enabled
Comment #16
jhedstromLooking into how the current taxonomy reference handles this, the bundle (vid) setting is actually on the Views filter, so contrib could actually mimic this functionality until this goes into core.
The tests for this functionality reside in
TaxonomyIndexTidUiTest.Comment #17
jhedstromThis gets everything working as expected. I had to use the handler settings from field config on the view filter settings, but this actually worked out quite well.
Setting to needs review so tests can run.
Also removing the VDC tag since this really has nothing to do with that.
Comment #21
jhedstromAaah. Version temporarily back to 8.0.x to get testbot happy.
Comment #24
jhedstromFixes schema error in test view.
Comment #25
jhedstromBack to 8.1.
Comment #26
jhedstromSince #1847596: Remove Taxonomy term reference field in favor of Entity reference landed, I think this can safely be re-categorized as a task, rather than a feature request?
Comment #28
jlbellidoSince it's a task, not a bug, it think this should be done at 8.2.x-dev.
Comment #29
jlbellidoI'll try to reroll #24 for being applied to 8.2.x-dev
Comment #30
colanThere's a contrib module over at Entity Reference Exposed Filters. I haven't looked at the code so I'm not sure if it would help with what we're trying to do here.
There's also a blog post over at Entity reference filter with Drupal 8.
Comment #31
howards commentedI hope the "render views filter as select list" feature gets looked at again and will do my best to help provide any information and even potentially patches if I can find the time. Initially I tried patching the Drupal code base with the patch in #24 but it no longer applies due to changes in core. Hoping to reference the related changes in an effort to coalesce the related changes and make it easier both for myself and others to take a stab at a patch.
Two files referenced in the patch were removed via #2429191-189: Deprecate entity_reference.module and move its functionality to core and the committed patch might provide some insight into integration areas.
Edit: the commit is 97823b5a
Comment #32
howards commentedIt appears the original issue title appears more correct, as it seems to be purely a views exposed filter issue, not necessarily a TaxonomyIndexTid filter. That said, it also appears the TaxonomyIndexTid filter does provide somewhat of a roadmap to get there through entity reference and views configurations.
Similarly, as I was looking to re-roll the patch in #24 to D8.2.x, information in the entity_reference module is deprecated in 8.x. I can reroll a patch that recreates a similar structure, but I don't think that's the correct path to go down in terms of down the road given the deprecation notice. It seems like a short-term, non-commitable fix. (Am I wrong? Is it something that will just need a forward-port in a couple of years?)
Would the right way to go be adding a pluggable module in
core/modules/views/src/Plugin/views/filter, or even adding code to an existing plugin, as most views filters are placed? There is also other code that exists to provide appropriate exposed taxa filters, but seem to be generally contained within the core/modules/taxonomy module. Many parts of the taxonomy module are deprecated as well, along with removal in D9.x.I am not a particularly adept coder, although I can read it understand it; reproducing it is a different story. (I can try, but it is open to all sorts of scrutiny; I welcome the scrutiny because it will help me to get better.)
I am lost as to what to do or where to focus, or how best to approach it. Any guidance would be appreciated.
Comment #34
taran2lRe-roll against 8.2.x
Comment #36
taran2lFixed incorrect schema
Comment #38
i.bajrai commentedI have patched Drupal using #36.
Go to the field you want to update and under field setting is the familiar checkbox.
Flush the caches.
Then update the exposed filter in your view.
Pretty sure this can RBTC?
Comment #39
jsst commentedI've attached a new patch based on #39 (see interdiff) to support references between entities of different types (#39 used entity_type where I believe target_type was intended).
I've also changed getValueOptions to support not having any bundles selected (my entities don't have bundles!). I'm not sure about that should that be supported? I have to override getSelectionHandlerOptions() to make the filter work without bundles:
Note that target_bundles needs to be NULL, not [], in order to show all entities instead of no entities (that's how Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection works).
Comment #40
berdirNot sure why we're not actually doing the same as TaxonomyIndexTid as suggested in #9/#10. The current behavior of having an exposed field for the ID never makes sense.. why not add the autocomplet-or-list setting that TaxononomyIndexTid uses too? We have generic entity autocomplete..
Comment #41
jibranTagging.
Comment #42
jibranComment #45
_Archy_ commentedAs Berdir said so did I. Brought big part of the functionality from the TaxonomyIndexTid. Removed the possibility to select the target bundle types, seems to me weird, but it can be readded if you think it can be useful. Now it detects from the displayed entities the possible target bundles. Also removed from the entity reference field the setting to allow for views filtering, so now it's by default enabled. Coding standard fixes.
With this patch the filter can be select or autocomplete. This seems to work with nodes, but a lot of work is still left. Also this patch needs cleanup: config schemas.
About the problem with too many entities: I think we shouldn't disallow the filter, but rather alert the user about possible problems. As I see, it can only have problem with the select type, but the user should decide whether he wants select or autocomplete as he will know how many target entities will be possible.
Comment #46
_Archy_ commentedComment #47
_Archy_ commentedDid not create the patch properly. Also I did not update the tests so this will break.
Comment #50
_Archy_ commentedFixed referenced entity type always node and added support for entities that don't support bundles. Other minor improvements.
It works for nodes and users. I don't quite understand why for files the core_field_views_data is not called. Can someone enlighten me. How are they special. I notice that for file and image reference fields in the views filter list they don't display independently, but rather all their fields.
I need some guidance and feedback to continue work on this.
Comment #52
_Archy_ commentedSince target bundles are not options anymore, at least for now.
Comment #53
berdirComment #54
berdirThanks, this is a good start, great to see progress on this. I'll try to look into that file problem you mentioned.
For now, reviewed the patch.
I think this is no longer needed as we no longer need that setting? Also for file and image.
why do we need an in memory cache of this information?
\Drupal\Core\Entity\EntityTypeBundleInfo::getBundleInfo() is already statically cached, if we use that, then we don't neeed this IMHO
this also seems not necessary, we just save two methods calls, a method can be useful for this but a static cache seems overkill.
not sure what's special about this filter that it needs a property for this, I guess this was taken over from the public property of the other class (which I suppose also means it would be hard to deprecae the code there and extend from this. But we could still deprecate it eventually)
this is only needed for the else case, we should not need to load all entities for autocomplete?
we don't (yet) use camelCase for local variables I think.
and we usually don't put the type in variables, this could just be $entities when the code above moves to the else. or $default_entities or something like that.
entity types actually have a plural label, check the entity type definition object.
there is a lowercase method for the entity type label, but that's flawed and doesn't really work in many languages.
You could use a neutral label like "item", we often talk about "content items" or so in the UI.
we use those magic strings a lot, can we make them constants on the class?
this needs the same check as the auto-complete above for having bundles? also, can't we re-use this for the selection settings, then we need this logic only once?
this is not an assumption that we can make. This could be a filter on a list of terms, the bundle condition is something else there, or the condition could be based on a relationship or so.
What I would do is just look for all fields of our field storage definition, you can't use \Drupal\field\Entity\FieldStorageConfig::getBundles(), but as you can see there, that's just a wrapper for the field map, we can use that.
Then loop over those. In 99% of the cases, all fields are going to have the same allowed reference. But we could just show them in the extra settings like the taxonomy filter does.
Comment #55
_Archy_ commentedThanks @Berdir for the feedback. I will try to work more on this when I have time.
This is only for 8.2.x, it was not applying cleanly. No changes made.
Comment #56
_Archy_ commentedWell creating patches is not my strongest point :D. Did not include new files..
Comment #59
_Archy_ commentedDid some work. Changed the way getReferencedBundles() works, readded the option of selecting the bundles in the extra config and fixed most of the notes in #54. Now it works with taxonomy (to test comment taxonomy.views.inc:67).
Comment #60
_Archy_ commentedAdding for 8.2.x.
Comment #63
_Archy_ commentedAdded check to see if target bundles is a setting on the field to prevent notices.
Comment #65
jastraat commentedThe patch in #63 successfully allows displaying an exposed entity reference field as a select or autocomplete in a view.
However - it would be a really nice feature to have the ability to order by something other than node ID. For example... node title?
Comment #66
akozma commentedComment #67
jastraat commentedThe last patch appears to still work with 8.3.x.
Comment #68
akozma commentedIn order to not block this issue, I added a new task for the sorting feature (patch included).
See Entity reference view filter, ability to order values by selected field
Comment #69
akozma commentedComment #70
das-peter commentedThe patch in #63 messes up the reverse relationship handler because it re-assigns the variable
$field_name.The foreach that ensures the filter id is set to
entity_referenceshould use another variable name.Re-rolled a patch against 8.3.x, should work with 8.4.x too.
Comment #72
adrian83 commentedI'm excited to see progress on this issue. As more builders use entity reference instead of taxonomy for expressing relationships, we will be bumping into the entity reference limitations more. I like the implementation in #10.
Comment #73
aaron.r.carlton commentedThe patch in #63 is breaking for me in a total unrelated condition. I have a view of taxonomy_terms and am adding an entity reference display. When I add a relationship to the view which uses a taxonomy term entity reference field, the module incorrectly builds the query adding a 'target_id' to the reference field of the query, resulting in a SQL error looking for *_target_id_target_id. This was on Drupal 8.2.x.
I recently upgraded my DEV site to Drupal 8.3.x and build the entity referernce view display just fine, without the patch installed. When I re-applied the patch (successfully) to 8.3.x, loading a page with my view, or the view itself results in the following error page below.
Would like to provide more testing and information, but don't have time ATM.
Exception: No entity type for field type on view commodities in Drupal\views\Plugin\views\HandlerBase->getEntityType() (line 697 of core/modules/views/src/Plugin/views/HandlerBase.php).
Drupal\views\Plugin\views\filter\Bundle->init(Object, Object, Array) (Line: 888)
Drupal\views\Plugin\views\display\DisplayPluginBase->getHandlers('filter') (Line: 1029)
Drupal\views\ViewExecutable->_initHandler('filter', Array) (Line: 887)
Drupal\views\ViewExecutable->initHandlers() (Line: 2245)
Drupal\views\Plugin\views\display\DisplayPluginBase->preExecute() (Line: 1678)
Drupal\views\ViewExecutable->preExecute(Array) (Line: 1613)
Drupal\views\ViewExecutable->executeDisplay('entity_reference_1', Array) (Line: 220)
Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection->getReferenceableEntities() (Line: 561)
Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem->getSettableOptions(Object) (Line: 116)
Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsWidgetBase->getOptions(Object) (Line: 34)
Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsSelectWidget->formElement(Object, 0, Array, Array, Object) (Line: 322)
Drupal\Core\Field\WidgetBase->formSingleElement(Object, 0, Array, Array, Object) (Line: 85)
Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 168)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object, Array, Object) (Line: 122)
Drupal\Core\Entity\ContentEntityForm->form(Array, Object) (Line: 98)
Drupal\node\NodeForm->form(Array, Object) (Line: 115)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 514)
Drupal\Core\Form\FormBuilder->retrieveForm('node_pickup_form', Object) (Line: 271)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object) (Line: 113)
Drupal\node\Controller\NodeController->add(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comment #74
leksat commentedHi there,
There is an issue with ManyToOne discovered in #2559961: ManyToOneHelper ignores group configuration for some cases:
Here is an example of a buggy behavior (with the fix-group-condition patch applied).


Content:
Result:
It's currently not decided how to fix the INNER JOIN issue nor whether it needs to be fixed.
As the taxonomy reference field is currently the only field that uses ManyToOne, I was going to create "Stop using TaxonomyIndexTid for taxonomy reference fields" issue. But then I found this issue and I don't really know what to do. So, I just inform you about the bug.
Comment #75
acidaniel commentedWhat about to make it working when the field is included on a search index and those values you want them into a dropdown or autocomplete?
Comment #76
dawehnerOne could argue that it would be better to use the bundle info service, given that those labels might come from something else.
This message should be translatable.
Nitpick: Let's use EntityStorageInterface
Its nice to have this helper method available
We could use the tricky to flatten the array in one line:
call_user_func_array('array_merge', $entities), but I believe writing it out is actually easier to read.Not your fault, but all this code is just quite sad ...
Let's ensure to have short array syntax
This method name doesn't really communicate that these are all referencable bundles.
Don't we need some update path for that?
Comment #77
drunken monkeyI guess you meant to set this back to NW?
Comment #79
luksakI am using this patch on a field that references users on 8.3.4.
I keep getting those warnings:
Comment #80
_Archy_ commentedWell I am back to this feature. I've just encountered the case where I need the handler to work with fields that use view selection handling.
Have taught about it and it seems too difficult to handle that case in the best generic way. For example if two bundles implementing the same field are displayed in the view and both these fields have view selection handling, how would you provide the available values for the filter? The ideal way would be merging the two views results for the filter values. To make things more complicated add the possibility for an additional bundle with same field that references directly bundles. Then the two views results would have to be combined with all the entities of that bundle. Which makes this even more complicated, how do you handle all this with the autocomplete field? We would need a new selection handler.
I've will implement this in an easier, limited way for the moment: in the settings form you will have to select whether you want to add bundles for filter possibilities or ONE view selection handler if any exists.
Comment #81
_Archy_ commentedAdded support for view selections, described in #80. Also addressed most of the comments in #76. Point 9 I didn't understand the request.
Comment #83
_Archy_ commentedSeems to work with my manual tests.
Comment #84
luksakIn "Possible selection values from" the only option is "View result". The "View selection" is empty. Do I have to create a specific view before I can choose it?
Comment #85
_Archy_ commented@Lukas von Blarer you have to have the "reference method" setting as "Views: Filter by an entity reference view" and NOT "default" (for at least one content-field) on the reference field for which you are adding the filter.
Comment #86
luksakAh ok. I'll try that. Thank you!
Comment #87
luksakI think it would be better if the user could choose to use a differnt view or display for the selection. It gives the possibility to restrict the exposed filters in a flexible way. As an example: I am using it to only display options that yield results.
I did a rough implementation of that. It is missing a few things:
Comment #88
Christophe Bourgois commentedSubscribe ++ (ttt)
Comment #89
manuga commentedThe first fail in the test:
Schema key views.view.test_filter_entity_reference:display.default.display_options.filters.status.value failed with: variable type is boolean but applied schema class is Drupal\Core\TypedData\Plugin\DataType\StringData
looks like to be in
+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_entity_reference.ymlwhere it says:
must say:
But i haven't tested it.
Comment #90
flabel commentedSubscribe+
Comment #91
_Archy_ commentedComment #92
seanbFixed #89
Comment #95
avogler commentedI tested #92 manually. Works as expected but one thing I noticed: If there is more than one field referencing the same entity but only one is set to use a reference type of "Views: filter by an entity reference view" and the other uses "Standard" you'll get a warning:
Comment #96
ckaotikSome additional comments after just trying to make this usable with search_api:
+ $entityType = $this->getReferencedEntityType();+ if ($bundleType = $entityType->getBundleEntityType()) {collectFieldsReferenceHandlersexpects there to be bundles to filter by, we should check this first.collectFieldsReferenceHandlers? Shouldn't the Views select options always be available, like when there are no bundles (think: user entities), and offer all possible view/display options, not just if configured in the field's settings?$view->get('base_table')check makes this unusable with differently named source tables, we could ask the ViewExecutable for its entity type instead of the View configuration entity:if (($executable = Views::getView($view_id)) && $executable->getBaseEntityType() == $entity_type) {With these changes,
collectFieldsReferenceHandlerscould look like this:Comment #97
didebruCould we make this work with config entities? That would be awesome.
Comment #98
ckaotikI've just run into a situation where target entities without bundles (in this case: selecting a commerce shop) cause the view to break when using the patch. It seems, my suggestions from #96 are not only useful for search_api, but actually required in general.
@Insasse, do you have an example use case for selecting config entities? Have you tried the new handler (possibly with the changes to
collectFieldsReferenceHandlers), or is it not compatible at all?Comment #99
ckaotikI've updated the patch for my remarks in #96. Marking as needs review for the testbot.
We still need to address #95 and possibly think about #97.
Edit: There are also some coding standards to fix, just went over EntityReference.php.
Also noticed that
if (in_array($view->get('base_table'), [$entityType->getBaseTable(), $entityType->getDataTable()])) {is duplicated, so the second instance of that should also be updated according to #96. Maybe even put the logic into a reusable method.Comment #101
didebruYes in our project we have 2 config entities that are used to control the output for our content, we want to filter our nodes by that.
I tried the patch but it is not working for me in this case.
Comment #102
adrian83 commentedHere is a tutorial related to this issue: https://atendesigngroup.com/blog/drupal-8-views-entity-reference-exposed-filter-select-list.
Comment #103
RKopacz commentedThis is a prosaic question, in the current state, right now, if I have a view of Articles, and I would like to filter it by a reference field that references a Basic Page, for example, what value do I put in the "Value" field in order to get the field to work? I don't mind putting a value in there but it is not clear what value to put in there. I've tried the node ID of the referenced basic page, the URL, and a text string of the Node Title, and nothing works, Is that filter not working at all in its current state?
I've created a relationship to the reference field on Article etc. But I can't get the list to filter by the value in the reference field.
If someone could point me to some documentation on that, I'd appreciate it. I've looked all over but I guess I'm using the wrong key word phrases.
EDIT: posted a support request here: https://www.drupal.org/project/drupal/issues/2955011
Comment #104
berdirI think it is unfortunate that we are hardcoding all those extra settings and then require all that mapping between selection plugins and hardcoded views settings.
I started looking into re-using the plugins to allow them all and to expose their own settings forms, so we don't have to reinvent things. That is quite a lot of work, but I did manage to make the extra fields show up at least. Just posting an interdiff with my current progress as I need to switch to something else for now.
Some of the exposed settings might be a bit bogus (like the one about auto-creating entities) but I think that's not a big deal.
Not actually less code yet, as I just added a bunch of early returns, but I hope to get there eventually.
Comment #106
rosk0Trying to continue from where @Berdir finished.
Comment #107
rosk0Made some progress. Views are now selectable and everything is actually works. Feedback appreciated.
I think we need to convert test from Drupal\views_ui\Tests\UITestBase to \Drupal\Tests\views_ui\Functional\UITestBase. Don't have time for it at the moment.
Comment #108
rosk0Wrong interdiffs...
Comment #110
rosk0Still on it, found issues with filter schema and test view.
Comment #111
rosk0Removed copy paste element validate property, disabled auto create option, fixed formatting, fixed sorting handling for default handler, removed unused variable, fixed filter schema, fixed test view, converted test to functional.
Test should go green, at least its green locally.
Comment #112
Chris CharltonTests are green! :)
Comment #113
rlmumfordThe configuration form doesn't work if the field is a user a reference. If you select 'User role' under 'Filter By' the role selector does not appear. Investigating...
Comment #114
rlmumfordWent through and made sure the handler settings configuration worked. Removed all of the duplicated hard coded references to target bundles and let the Selection plugins massage the configuration. Tested with user entity reference fields (limiting by roles).
Still needed the hack for the AJAXified Selection plugin configuration forms.
Comment #115
finex commentedHi, is this patch "safe" to use on production or is still under development? Thanks :-)
Currently I'm using on a test website and it works for me :-)
Comment #116
panchoVery nice. I'm using this one in my beta production environment now, and while I hit a fairly minor UI bug with views preview (#3027858: Exposed filter widget change triggers 'illegal choice' resp. 'no matching entity') it has been taken over from TaxonomyIndexTid. Actually I also hit a second bug taken over from TaxonomyIndexTid, but have failed to reproduce. Using a generic filter plugin for all kinds of referenced items is a good thing - it will get the code more exposure, so bugs will evaporate over time.
Comment #117
ckaotikThe patch in #114 produces an error when trying to change the filter value, because the
entity_autocompleteelement requires full entity objects (or NULL), not the names. We should changegetDefaultSelectedEntityLabelstogetDefaultSelectedEntities. In case of large amounts of entities, can we just set the value to NULL, instead of loading all of them? The autocomplete input has a length limit iirc ...Comment #118
ckaotikTo make life easier for site builders, we should probably also improve the admin summary of the filter. Maybe add the selected entities to the value options and rely on the parent class?
Displaying the entity id is easiest, but the entity label should be better still. Unfortunately,
EntityAutocomplete::getEntityLabels($entities)returns a string instead of an array - and exploding on,would need to consider escaping etc.Comment #119
pancho'#process_default_value' => FALSEdid the job. Note that this is also the additional bug I mentioned in #116, so another box checked.Hopefully still green, so no new bugs introduced. Two or three more glitches to be fixed, and then we should be relatively close.
Comment #121
panchoFixed coding standards + another instance of a camelCased local variable
Comment #122
pancho1) Note that when the filter is not exposed, operator is either of (one/all/none of) and no default is chosen I'm now getting a validation error:
There's no validation error when using the TaxonomyIndexTid filter in the same configuration, but I guess it's correct that the warning is there now, so it's another previously existing, now fixed bug rather than a new bug, if I'm right. We might want to catch the validation error earlier though by marking the default value field required in this case.
2) In any case, if the operator is unary (one of empty / not empty), we need to hide the value field, both for the default value and in the exposed filter. StringFilter, NumericFilter and others get it right, TaxonomyIndexTid doesn't. I'm preparing another patch that fixes this.
Comment #123
panchoI looked at both the code and the UI of all implementations, and the code is horrible and (at least if I got it right) not even a single filter class gets it right:
Enclosed patch puts that logic into code, and from what I know, it works correctly and is much cleaner codewise.
However, the actual result looks a bit weird, as the "expose operator" checkbox may show/hide the filter value field above. In the end, I have no idea why the "expose operator" checkbox along with its identifier field is located in the right column under the filter value and not in the left column right under the operator it belongs to. Changing this, however, is beyond the scope of this issue.
I'm happy to accept if someone convinces me that I missed something and got it wrong. But if the logic is approved here, it should be rolled out to the rest of the filter subsystem anyway.
Comment #124
panchoForgot to post a small screencast showing how my new logic looks like.Ignore this one please.
Comment #125
panchoOops, this is the right video. Sorry for the noise.
Comment #126
panchoWe can actually decide later if fixing the twig template is out of scope or not. I'm enclosing another patch that provisionally fixes the two-column floatbox design. Further layout changes should in any case be covered in a followup.
Comment #128
panchoFixed field visibility for the actual exposed filter, too. Reorganized the code a bit to avoid any unnecessary HTML if the operator is not exposed, while avoiding redundant code as well. Manually tested, should be fine now. Sorry for the noise.
Comment #130
panchoForgot one instance of the internal variable
$exposedI renamed to$is_exposedto be a bit more verbose. Hope it is green now.Test coverage needs to be further expanded.
Comment #131
panchoNext step: I'm rebasing TaxonomyIndexTid on the new generic EntityReference filter.
Unfortunately I need a minor patch to the TermSelection handler to make hierarchy prefixes optional. This currently isn't configurable in the EntityReference selector, and my patch doesn't add any UI to entity references, though it might be easily done in a followup, if desired.
Also, I'm hiding the 'auto_create_bundle' handler setting which doesn't apply to views.
Surprisingly everything works well, including the otherwise unchanged TaxonomyIndexTidDepth filter that is now based on the new TaxonomyIndexTid. We might want to figure out, if and how we can reintegrate the depth option into the main TaxonomyIndexTid filter, but that's definitely out of scope here.
Let's see if the tests agree, and if they do, that's something. Finally, our test coverage should be considerably better now, because of prexisting tests against TaxonomyIndexTid. If everything stays green, we should be veery close.
Comment #133
panchoConfig is one of the remaining problems.
Added the dependencies that the taxonomy tests are expecting:
However, if we stick with the current config structure (bundles in handler_settings), then this will not be compatible with preexisting views and we need an upgrade path. We however need an upgrade path anyway, as the old TaxonomyIndexTid had the (single allowed) bundle under the key 'vid', and we certainly want this to be consistent across all entity types.
I also refactored EntityReference::getDefaultSelectedEntityLabels into getDefaultSelectedEntities as previously proposed by @ckaotik. The previous method was far too specific to be reused anywhere except for autocomplete default values.
Let's see if the tests go green, in which case I would be done for now. We still need a decision on how to proceed with the bundle config as well as the upgrade path for TaxonomyIndexTid. Input on this and more generally a thorough code review would be welcome!
Comment #135
panchoRenamed the 'type' setting to 'widget' both to be clearer (there are so many "types") and more accurate (select or autocomplete aren't different "types" of filters, they are widgets).
Also renamed the values 'select-list' to 'select' and 'auto-complete' to 'autocomplete' to be more in line with how we call it elsewhere.
Config is tricky, and on my local testbed I continue to get 3 errors, but at least it should be a bit closer to green now, and I'm definitely running out of time for today. Input welcome.
Comment #137
panchoFixed one of the three failures. Minor glitch introduced by myself, should be okay now.
The two remaining ones:
Yes, it's missing schema, but it shouldn't be there in the first place after being renamed to 'widget'.
Feel free to step in as I've run completely out of time now.
Apart from that some input is needed what this weird 'error_message' setting in the old TaxonomyTermTid filter was meant to accomplish. Apart from the setting, I didn't find any code related to it, so almost certain it was useless and can be fully removed.
Comment #139
panchoFixed the two failing tests in TaxonomyIndexTidUiTest. For one, it manually tries to change the filter 'type', now officially 'widget'. Also, 'target_bundles' may not just be empty but not set at all, courtesy of the handler, so we need to check its existence.
The only test that should still fail is the wizard. I'd need some more time to figure it out.
But in the end, I think we need a maintainer to decide if we want to go ahead with this handler architecture at all or not.
Comment #141
panchoThink (or better: hope) I finally got it right: the ConfigSchemaChecker kept throwing exceptions. This may only have started with patch #133 when I introduced the dependency calculations. Obviously only those triggered the ConfigSchemaChecker, because until #131 there were only some foreseeable test failures.
Now I fixed the Node view wizard (which now allows as many tags fields and as many bundles as desired). The ConfigSchemaChecker kept complaining, but the schema should be correct now. Config-inspector says OK, too.
[edit: There is at least one more preexisting issue with AJAX in the handler setting, at least until the view is saved. Manual testing suggests it is related to the "AJAX hack" mentioned in #114. If someone can reproduce it, they might get an idea what's wrong there. We probably need test coverage for that dialog, too.
Otherwise, the tests have gone green and we may proceed to a thorough code review. I'm unassigning for now.]
Comment #142
scott_euser commentedI have not looked at the code, but have tested this out in terms of functionality and was able to:
Thank you for all of the effort that has been put into this thus far.
Comment #143
jhedstromI'm removing the 'Needs tests' tag. This is still tagged as needing an IS update, perhaps a picture of the new UI change this provides could replace the old one from D7--I'm not sure if any other IS updates are needed.
Comment #144
skylord commentedHm. After applying patch from #141 views edit window stopped working - server memory limit (about 512Mb) and maximum execution time allowed were not enough for it. Maybe because of potentional long select list of referenced entities (about 2k)....
Comment #145
grathbone commented@scott_euser Related to your comment in #142, I'm actually running into an issue with Better Exposed Filters returning the error
Notice: Undefined index: type in /var/www/docroot/modules/contrib/better_exposed_filters/src/Plugin/views/exposed_form/BetterExposedFilters.php on line 325It seems to be looking for 'type' instead of 'widget' on taxonomy terms. I know it's related to Better Exposed Filters, but wanted to note since I saw your comment about it working.
I opened an issue and related it back to this issue, as well as added a patch.
But this makes me wonder if changing the 'type' to widget could potentially cause problems with other modules.
Comment #147
panchoJust a straight reroll of #141 against current dev.
Interdiff didn't work in this case, added a plain diff instead.
Comment #148
panchoJust some minor tidbits.
@scott_euser: Thanks! Yes I think it's working quite flawlessly. I've been using it in production for a week or two now, and it turned out very nice. There's however still the AJAX issue in the handler setting until the view is saved once (as described in #141). If someone can figure that out, that'd be awesome. I probably won't have time for that in the next two weeks.
@skylord: Yes, a select list with 2k entities will bring it down. We could set a limit of max. 100 select options, otherwise switching to autocomplete. Finally, a select list with 2k entities isn't usable either.
@grathbone: Thanks for filing BEF issue #3032467: Issue with upcoming change to Entity Reference/Taxonomy filters in Core. Indeed, $options['type'] is now $options['widget']. We might however do some BC on Core side.
Comment #150
eglawI have a commerce2 project.
I have this patch installed #141, which applies on Drupal 8.6.10.
This patch works on Commerce product fields on entity_references.
I have plenty of Custom Content Entities (let's say A,B,C,D,E,F....)
They have entity_reference between them ... lets say B has a *a_ref* which references A.
In a view that shows B entities (whatever display let's say table) - the exposed filter of field *a_ref* CAN'T be chosen as Select.
What am i missing ?
Comment #151
Anonymous (not verified) commentedThanks for all the hard work.
Patch cannot be applied to the current 8.6.15 version.
Comment #152
panchoPatch #148 still applies against 8.8 and 8.7, which is where new features/tasks are landing.
The last one still applying against 8.6 is #141.
Comment #153
Anonymous (not verified) commentedThanks @Pancho.
The patch #141 applies perfectly.
It seems there is no option to alter existing entity reference view filters, right?
It would be nice if there was a setting to use autocomplete, my view hangs up since there a lot of nodes that could be referenced.
Comment #154
glass.dimly commentedThe patch from #141 applied cleanly against 8.6.14, and works great.
Comment #155
c.e.a commentedPatch #141 applied cleanly on 8.6.15 with no errors.
Patch working as expected and used with Better Exposed filters module as well...
Thank you everybody for your hard work!
Comment #156
oriol_e9gI will review the patch in depth tomorrow but, can we address the new two coding standards warnings added?
Missing coma after
'direction' => 'asc'and'auto_create_bundle' => ''.Comment #157
c.e.a commentedI found a small problem with both patches (#141 for 8.6.x) and (#148 for 8.7.x)
When add a new entity reference field within the filter section of a view, the settings page made available due to patch #141 will automatically open...
Now, try to change the option of Reference Method select list field from Default to Views: Filter by an entity reference view and you will notice that: the "settings" page will auto-close and the "Add Filter" page will re-open again.
Expected Behavior:
The settings page must remain open/active in order to continue the configuration of the filter field.
Comment #158
c.e.a commentedPatch #148 applied cleanly to core release 8.7.0
Note: for anybody else encountered an issue of making patch #148 works on 8.7.0 release, make sure you are applying the right patch for the right core release from this issue #2174633: View output is not used for entityreference options (currently the patch #273 is working great on 8.7.0)
Comment #159
oriol_e9gOnly addresing the two CS warnings related in #156
Comment #161
oriol_e9g1. When we get the entities we can limit the requested entities. EntityReferenceAutocompleteWidget has a hard limit to 10, and there is an issue to add a new setting #2863188: Hardcoded result size limit in the entity reference autocomplete widget.. Maybe we can add const for a hard limit and open a followup for a new setting.
2. If we change $options['type'] to $options['widget'] maybe a CR will be suficient?
Comment #162
oriol_e9gSorry for the noise, this is the correct patch.
Comment #163
scott_euser commentedThanks for the continued updates to this! #148 works for me as before but now in 8.7.
Retested the following:
The patch in #162 unfortunately had errors for me with missing 'vid' in exposed filter settings for existing filters.
Comment #164
aaronbaumanComment #165
brooke_heaton commentedThis patch now fails on 8.7.1 since the core module is now at schema version 8701.
Comment #166
c.e.a commented@brooke_heaton I am running Drupal 8.7.1 with the applied patch #148
the patch is applied cleanly and working as expected with no errors.
Comment #167
dww@brooke_heaton re: #165: I don't see anything in patches #148 nor #162 that include any schema updates at all. Not sure why you think it matters that the core module's schema version is now 8701. Was your comment perhaps for a different issue where there are DB updates involved?
Meanwhile, since I was curious and it hasn't been posted, here's the interdiff between #148 and #162. As advertised, it's only the 2 minor code style fixes. Folks should use #162 as the basis of any future work going forward, and should focus reviews and testing there.
I don't have time now for a thorough review, but I'm definitely interested in this issue and hope to be able to put some energy into it in the coming days.
Finally, I'm hiding a bunch of older, stale patches and interdiffs. I'm leaving #141 as the last patch that applies to 8.6.x. #162 is for 8.7.x and 8.8.x.
Thanks,
-Derek
Comment #168
dddbbb commentedJust tried D8.7.1 with the patch from #162. Seems to work but I did notice 2 oddities:
1. Existing filters on the view I tried to add entity ref exposed filters to were reset. E.g. a term ref field filter was no longer associated with a vocabulary. Manually updating the filter and saving worked around issue.
2. Adding an entity reference based filter to a view exhibited strange behaviour: after adding the new filter, attempting to configure the filter (even just selecting a content type to reference) triggered an AJAX load and I was dumped back into the "Add filter criteria" modal. Fortunately, my filter had still been added but I had to exit the modal and click the filter's "Settings" link to then configure it.
Minor WTFs with manual workarounds but I'd be shocked to find this shipped in core. Thanks for all the hard work so far! :)
Comment #169
c.e.a commented@danbohea same as I explained in my above comment #157
Comment #170
aaronbaumannit pick: if we get another re-roll, can the next patcher please remove the extraneous "2" from the patch name, so that it matches the node id of this thread?
22429699-162.patchComment #171
dddbbb commented@C.E.A I missed that but yes, your comment sounds like the same behaviour that I mentioned in my second point :)
Comment #172
brooke_heaton commented@dww - hm, my bad! Yes, this must have been for another patch. My apologies! Carry on! :/
Comment #173
c7bamford commentedThe selection group plugin is being obtained incorrectly in \Drupal\views\Plugin\views\filter\EntityReference::buildExtraOptionsForm() on lin 98. $this->selectionPluginManager->getPluginId($entity_type->id(), $selection_group_id) should be used instead of concatenation. The current method does not allow selection plugins to be overridden.
Comment #174
joachim commentedThe class docs are wrong.
Also, I can't get this to work, so the issue summary needs updating with instructions on how to test.
I did this:
1. created an entity reference field on a node that points to a custom entity,
2. created a view of nodes
3. added a filter on the field I'd made
I see the same old textfield for the filter.
Comment #175
_Archy_ commentedComment #176
_Archy_ commentedSo I have been looking into this some more to see what has been done and to maybe continue the work on it as of DrupalDevDays in Cluj. I have found a serious issue with the submission of extra options form, which seems to be related to the fact that for some reason even if there are errors on the form state in the ViewsFormBase in the getForm method it is skipping an important if and subsequently closing the modal without actually saving (in case the below clause would evaluate it would function correctly):
I have not yet figured out why this is happening. I will continue debugging this in the next few days.
Comment #177
panchoThanks for looking into the remaining bugs!
In the meantime, here's a plain reroll against current dev.
Comment #178
panchoThat may be the case, so we should follow that underlying issue, too, whether here or in a separate issue.
However, the more obvious thing here is that in
\Drupal\views\Plugin\views\filter\EntityReference::buildExtraOptionsForm(), while we're disabling the auto-create functionality:we were not disabling the AJAX callback (resp. the non-JS replacement button) that updates 'auto_create' depending on what is configured as 'target_bundles'. Not a big surprise that this would cause problems.
So by simply adding:
the bug is gone. :D
Is it the only/last one? I guess not. But it's probably been the most obvious and stubborn one.
Comment #179
panchoWhile #178 is an improvement, it unfortunately doesn't solve the whole issue with the extra settings form, as the bug will still appear when switching the handler before the filter has been saved.
However, we could simply lock the handler and defer the remaining issue to a followup. Finally TaxonomyIndexTid didn't support entity reference views either. Given we are at 179 comments, this might be the best way forward.
Regardless of this, I refactored
Drupal\views\Plugin\views\filter\EntityReferencequite a bit, simplifying the form element#parentslogic and some other things, fixing some misnomers, reordering helper methods, and fixing some comments. There shouldn't be any change in functionality vs. patch #178.Comment #180
panchoUse
SubformStatewhen propagating$form_stateto the selection plugin'sbuildConfigurationForm()andvalidateConfigurationForm()methods.Some more refactoring, particularly in
validateExtraOptionsForm. The plugin only needs 'handler_settings'. Also see #3061180: Don't allow all bundles if no target bundle is configured, after which there won't be much code left inDefaultSelection::validateConfigurationForm(). Not sure we should bother with it at all.Comment #181
panchoWould be nice if this passes all tests.
I'm now using
InOperator::getValueOptions()to populate$this->valueOptions, providing an 'options callback' instead of doing everything ourselves inbuildReferenceEntityOptions(). Also reordering related methods.@todo: Find a better way to enrich
$handler_settingsinTaxonomyIndexTid::init(), so we don't have to override the parent class. Maybe useHandlerBase::defineExtraOptions().Comment #182
_Archy_ commentedI have fixed the issue with the validation not saving the extra options form. Also I have introduced a maximum elements settings for the select widget. Defaulted to 30, debatable. Also added a warning log in case there are more than the set maxiumum when the widget is in select, also this is debatable to how we should do it, a problem with it is that currently it will generate many warning logs in that case. But I think it is still important to notify the site administrators.
Also I have tested manually many flows and did not find any minor to major issues.
I will do an issue summary update later.
Comment #184
_Archy_ commentedFixed coding standards issues. A little bit more of refactoring. Also added dependencies from selection handlers to the calculate dependencies.
Updated the issues summary to my best knowledge. I added that there are no API changes but I need confirmation on this. I've added a list of things that has been done and what still needs to be done. I did not check tests since there is only a single webtest that after my estimates only covers like 10% of the functionality. So I think we should add some more tests, maybe unit as well. I have also put question marks for todos that I am not sure about, so I need some opinions about those. What we should tackle in a different issue I've added to Post tasks. Feel free to complete this if you think it's missing things or they are incorrect.
Why are the filter configuration schema set to not translatable?
Comment #185
_Archy_ commentedComment #187
_Archy_ commentedCoding standards fixes. Some further code improvements. Added more test cases in the UI test and transformed the configuration modifications to drupalPostForms so that it know has better coverage of the functionality. There are still lots of cases that are not covered, but the most important are there. With this I guess we can set the tests checked.
Comment #188
_Archy_ commentedComment #190
panchoFixed the two little issues causing test failures. Should test green now.
Comment #191
pancho1.
Yay! We're getting closer...
Validation works now, however for some reason, the submit button goes from "Apply and continue" simply to "Apply". It still does continue, so this seems a minor glitch, even though something may be wrong with the stack.
I moved these lines:
to
ConfigHandlerExtrathough. This is where @dawehner put them in #2784233-5: Allow multiple vocabularies in the taxonomy filter, parallellingConfigHandler, and indeed I think this should be handled generically.2.
However, we still have the problem that switching either the handler or the sort key while adding a new filter will cause the dialog to return to the previous form in the stack rather than rebuild the current one. I managed to fix it for the non-JS case, but not yet for the Ajax case. This remains another
@todo.3.
We have to do something, given that quite some commenters noticed memory issues with hundreds or thousands of entities. However, I don't think this is a viable approach. If we want to cut the list off at the threshold, at least we'd have to pick a sensible sort order, but even then it will be defunct in many cases. That's why you're logging warnings.
I'd propose a totally different approach: whenever the (still configurable) threshold is crossed, we should automatically fall back to the autocomplete widget. This way we don't even have to log any warning, as relying on this is a safe, sensible and legitimate option for the sitebuilder.
So removed the new, yet superfluous
getReferencableEntities()helper, rolling some lines back intogetValueOptionsCallback()andvalueForm(), the latter of which was broken up into the two new helpersaddValueAutocomplete()andaddValueSelect(). We might want to further refactor them.4.
+ protected function getSelectionHandler(): SelectionInterface {Yay! Indeed we're no longer supporting PHP 5.6, so may declare return types for improved type safety and clarity. Added them to all functions in our new EntityReference handler and the two child handlers we're refactoring.
5.
Another problem is with switching widgets on exposed filters. Our very complicated logic doesn't seem to be 100% correct. We should take a stab at inheriting at least some of this, so this should need some more work, too.
All in all, the patch should be usable more than ever, but not quite ready for Core.
6.
Think we should rename the class to
EntityReferenceFilter, so it conveys a bit more of what it is, thereby avoiding confusion with all the other homonymous classes. Yes, display, row and style plugins are namedEntityReference, but per https://www.drupal.org/node/608152#naming we should be avoiding ambiguous class names, at least when adding a new class. Awaiting some feedback before going ahead with this, though.Comment #193
_Archy_ commentedI have started debugging the issues number 2. and I have found that it is caused by the fact that when first adding the filter the AddHandler forms controller path is rendered in the
tag, but the form_id input still has the ConfigHandlerExtra form id inserted into it. This in turn in the FormBuilder causes an if to not throw the FormAjaxException which would normally render the same form.
Now my problems is that I don't quite understand what is the expected behaviour here? Should the form_id be the one from the AddHandler or the path should be changed to be from the ConfigHandlerExtra since we are submitting that form. I will attempt to go with the first solution by changing the ID to the right one and see what happens.
Also @pancho thanks for your indepth review. Also I agree with the switch to autocomplete solution on the list_max, it actually is less of a problem than possible millions of warning logs.
Comment #194
panchoI will look into it later.
Here's a patch adapting the test that failed in #191 to our new fallback to autocomplete.
Comment #195
_Archy_ commentedSomebody has found the issue already, linking it here. I think we need to figure out how to change the route callback to go to getForm on ConfigHandlerExtra as oposed to AddHandler.
Comment #196
panchoTechnically, this means we have to postpone this issue on #2991982: Ajax in a Views filter handler extra settings form jumps back... :/
However, we're currently only enforcing PHP 7.0.8, so at least
voidreturn types would have to wait, see patch #194 failing on PHP 7.0.Also, while PHP 7.2 will bring parameter type widening (contravariance), not even PHP 7.3 there is parameter type narrowing (covariance). The moment we're requiring PHP 7.2 is when we may add proper parameter types to base classes without BC concerns. Only then we may add proper parameter types to extending sub-classes. We may however add them for our own (helper) methods.
Also adding/fixing a number of docblocks.
Comment #197
_Archy_ commentedI've kept debugging to understand better what is happening with the issue, but could not get to it's end. The bug seems to be highly complicated, also I won't have time to continue so unassigning myself. But here are some leads from where others can continue:
Comment #198
rosinegrean commentedComment #199
panchoThanks for your very helpful leads, @_Archy_!
I found the solution in EntityField. Yay!
Indeed, AJAX paths were the problem, and with the proper path being set, the callback gets called as well.
Comment #200
andypostit sounds like wrong to use views_ui module's function in views as I see the same inside
\Drupal\views\Plugin\views\field\EntityFieldso probably it is fine for "only working in UI" methodsComment #201
panchoWell, actually you're totally right that this seems more like a workaround, both here and in
\Drupal\views\Plugin\views\field\EntityField, and I noted in #2991982: Ajax in a Views filter handler extra settings form jumps back that this should probably be solved in a generic way.When constructing a form afresh,
ViewsFormBase->getForm()already callsviews_ui_build_form_url()and sets$form_state->urlaccordingly to be picked up byajaxFormWrapper.However, the
$form_keyreceived byViewsFormBase->getForm()isn't 'handler-extra'. It is 'add-handler', so this may not work.There's also this inconsistently commented code:
Either the comment is wrong ("not set for rerendering") or the code is. The opposite however isn't correct, either. I'm a bit confused by the whole code, and while I know #199 works, I unfortunately don't have any idea how to solve this more properly. Everything else I tried, didn't work.
Comment #202
michelleThe latest patch doesn't apply against 8.7.6. I realize core development goes against the bleeding edge but this patch is a major usability improvement and I would be so grateful if someone who has their head in this would be willing to make one against 8.7.6. :) There's only 1 failing hunk so I'm hoping it wouldn't be hard to do for someone already familiar with the patch. If not, I may try to tackle this on my own but I'm not very familiar with the inner workings of Views. Thanks!
Comment #203
_Archy_ commentedMaybe we can get some maintainer reviews so that additional work can be introduced with the next patch and thus we would get closer to it being introduced in core.
Comment #204
nuezReroll against 8.7.x
Comment #205
murz@nuez, seems there are a typo in generic_entityreference_filter_2429699-204-reroll-8.7.x.patch:
-
arraytmust bearray?Without this I got the fatal error on views edit pages:
Fatal error: Declaration of Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid::defineOptions(): Drupal\taxonomy\Plugin\views\filter\arrayt must be compatible with Drupal\views\Plugin\views\filter\EntityReference::defineOptions(): array in web/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php on line 17Comment #206
nuezDon't know where that came from. Here's another. I'll run the testbot. In any case, the patch from #199 is up for revision, which applies to the 8.8.x branch.
Comment #207
michelleThanks for that, nuez!
I'll test it out this weekend.Edit: Tested it and it applies against 8.7 with no issues and works great. Thanks again!
Comment #208
caspervoogt commentedI tested #206 on 8.7. I selected "dropdown" for the exposed filter, but it only renders as an autocomplete field. The dropdown/select UI option seems to be getting ignored. I saved my view, cleared caches, and edited again, but it remains the same.
Comment #209
_Archy_ commentedIf you have a lot of entities it wont allow for rendering as dropdown since it would cause memory and other issues. If there is not already a warning for this we should include one maybe under the field.
Comment #210
caspervoogt commented@ _Archy_ I have 79 published entities that I was trying to get into the dropdown. 83 total if I include unpublished ones. The UI appeared to suggest it cuts off after 30 entities, but I would have expected it to still render, but simply render the first 30 only.
Comment #211
damienmckennaThis needs a reroll.
Comment #212
damienmckennaRerolled.
Comment #213
damienmckennaFYI with the patch in #212 I'm seeing this error when I open a view which had an exposed ER field from before the patch was applied:
Comment #214
damienmckennaThis is the patch in #212 rerolled for 8.7.7.
Comment #215
damienmckennaI can also confirm that saving the settings dialog after selecting "selector" instead of "autocomplete" does not appear to save, it always shows the autocomplete field on the page and when reopening the settings form it goes back to showing "autocomplete" is selected. So basically Drupal\views\Plugin\views\filter\EntityReference::buildExtraOptionsForm() isn't saving correctly.
Comment #216
damienmckennaThis is what the exposed field looks like when it's exported:
Comment #217
damienmckennaGiven that there are two reports (#208, #215) of the select option not working, does the test coverage need to be expanded?
I've added another task for fixing this option, do we need to uncheck the "tests" task too?
Comment #218
caspervoogt commentedThanks for the 8.7.7 patch in #212. This does provide a select/autocomplete filter option for entityref fields that reference taxonomy or nodes (the only entities I tested) AND my choice of 'select' or 'autocomplete' selection type (for the exposed filter) is saved.
However, it still only renders as an autocomplete field, regardless of whether I choose 'select' or 'autocomplete'.
"Given that there are two reports (#208, #215) of the select option not working, does the test coverage need to be expanded?"
I suppose so. Also, FWIW, patch #212 applied cleanly. I see it failed testing but for me it applied cleanly. And when I was testing I watched my logs and saw no errors or warnings.
Comment #219
_Archy_ commentedI tested and the select widget works. I've added a warning about the entity limit for the select widget since it seems to me that UI was not clear enough about the limit, also added description about it in the settings form. The patch was not applying to 8.8.x I hope I fixed the conflicts accordingly, let's see the tests.
Comment #220
_Archy_ commentedComment #222
c.e.a commentedPatch #219 applied successfully on Drupal 8.7.7 with no errors and the added limit & description really make sense !
Thank you
Comment #223
_Archy_ commentedFixed the tests. Let`em pass pls. Also fixed the issue with the switching between the widgets and previous value not being compatible. This should be really ready for core, we just need some more reviews.
Comment #225
_Archy_ commentedPhpStorm doesn't like copy diff, somehow one of the test view config yamls disappeared.
Comment #226
anybodyWhao _Archy_ thank you so much, great improvements, works completely fine for me on 8.7.7. RTBC +1
This is a really important feature for 8.8!
Comment #227
caspervoogt commentedWow, _Archy_, that's a massive patch. Thank you for the work!
I just tested the patch from #225 on 8.7.7; it didn't apply cleanly using Composer but when I applied it from the command line it was OK; I just had to tell it which files to patch because it couldn't seem to find some of the files to patch. I tested it with a Views exposed filter but didn't get far; I got this on a brand-new view when I tried to add an exposed filter on an entity reference field (after having cleared caches a few times to make sure);
Not sure what I'm missing since it did apply cleanly and it worked for Anybody. Just not for me ;)
Comment #228
neograph734Forgive me for not having read through all 200+ posts here and many thanks for all the effort. I believe this is a great start, but I am missing the entity references provided by core.
For instance the Node entity uses entity references to link to a user for the 'Authored by' field (provided by the EntityOwnerTrait). I was more or less hoping (expecting) that the 'Authored by' field would now be available for a select drop down, but it was not. It does work when I add a custom entity reference field (referencing users) to the entity.
On a final note, the order of dialogs in views filters is confusing me. First I have to select that I want to render an autocomplete field or a select box and second I get to choose whether or not I want to expose the filter. I believe it makes more sense if the order of dialogs is flipped (and ideally if the filter is not an exposed filter, do not ask for the widget; I won't be rendered any way).
I'd say that this is not yet ready for production.
Comment #229
_Archy_ commented@caspervoogt The patch in 225 is meant for 8.8.x someone should do a reroll for 8.7.x
@Neograph734 Support for the authored by filter is noted in the issue description that a followup task should introduce it. And for the second argument with the configuration ordering I agree but this patch and issue has grown quite large. I think we should focus on testing it, reviewing it and getting it in 8.8.x; the ability to have this types of filters is more important than UX for the admins.
Comment #230
neograph734My bad, I was not aware that Views had a special filter for the user name. I thought it was a general issue for all references defined in entity definitions. I cannot test anymore today, but I'll take your for word for it that those will work.
I can imagine and would like to see it too. Thanks again :)
Comment #231
damienmckennaFor anyone who needs it, this is a diff between
214212 and 225.Comment #232
damienmckennaThis is a combination of #214 and #225 for 8.7.x.
Comment #233
damienmckennaNote: I'm not sure the #232 diff has all the test files, so the tests might fail. OOps. The files that failed were exported Views defaults, so they might need some manual work to fully reroll the changes in #225.
That said, the patch works for me - the filter settings saves correctly, the "limit" option works correctly, and fields with an item count under the "limit" value are indeed displayed as selectors. Yay!
(of course now we're seeing that some of these views needed to be Search API queries with facets, but that's another story)
So a big +1 from me!
Comment #234
caspervoogt commentedtested the patch from #232 on 8.7.7 and it works great. RTBC from me.
Comment #235
marcoscanoJust posting here my experience with patch #232, which applied cleanly to 8.7.7 for us.
It does allow me to create a new view with an exposed filter on an entity reference field using a select element, by referenced content's title.
It did introduce a negative side effect though. In an unrelated view, a taxonomy exposed filter stopped working, is that expected? Since no DB updates are introduced, I would expect that existing views would be unaltered by this patch.
Here's my existing filter configuration that stopped working after applying this patch:
When visiting this view now, it displays an input text element, instead of the select dropdown that the field is configured to use.
Not setting it to NW since I don't know if that's expected, and I also haven't tried to reproduce on a vanilla install.
Comment #236
rgpublic@marcosano: AFAIK the configuration is a bit different now (i.e. after the patch). The taxonomy term is now just one case among other others and not "special" anymore. So, you now have to define "widget: select", "handler: default: taxonomy_term" and handler_settings with target_bundles, for example. You can find that if you create a new view after the patch, export the configuration of that one and compare how the taxo field is defined. What I don't know is whether there should be database updates. Probably yes, I'd say, because existing views break otherwise. Perhaps someone more knowledgable can tell why this doesn't seem to be implemented yet.
Comment #237
damienmckennaSounds we either need an update script or the configuration needs to be adjusted to be backwards compatible.
Comment #238
marcoscano(Cross-posted, thanks @DamienMcKenna and @rgpublic!)
OK, just confirmed that by changing:
in the pre-existing view, the filter is back to what it was, so we definitely need an upgrade path here. (Also a quick search for "upgrade path" on this page shows that @Pancho on #133 had apparently raised this point already :P )
Comment #239
_Archy_ commentedGood catch. When I was modifying the issues description I've added a point for existing config migration with question mark since I was not sure we needed one, but now its for sure.
Comment #240
_Archy_ commentedReuploading patch to trigger tests since it was added for wrong version.
Comment #242
lefale commentedThis patch is wonderful and thank you all for your hard work. Here is an issue that I encountered (using Drupal 8.7.X).
When using a View (along with the select widget) to populate the list of options, the entity label is used for the option label. Is this the normal behaviour? I was expecting the label to be the output of the view (as rendered by the Row Renderer plugin) since my view display uses a field of the referenced entity instead of the entity title.
It is worth mentioning that the list of options is populated correctly in the node edit form, so I guess both lists should look identical.
Comment #243
dww@lefale re: #242: That's at #2174633: View output is not used for entityreference options.
In addition to the 2 failing tests, this also introduces the following code standards violations:
I need this on a project I'm currently working on, and hope to have time for a more thorough review, testing, and possible re-roll next week. If I start working on the patch itself, I'll assign to myself. Otherwise, if anyone else wants to work on the failing tests (which on quick skim seem like legitimate failures) and the code style bugs, please do. :)
Cheers,
-Derek
Comment #244
m.lebedev commentedHi! I think that the option "Maximum entities in select list" should not be required. Limiting up to 100 items will affect the expected result of existing sites.
Comment #245
_Archy_ commentedIt has to be required for two important reasons. firstly if there are too many entites we can get out of memory errors or the view can get super slow till the point of unusability. second is that if you have more than 100 entities in a select list that is in no way ux friendly and you really need to reconsider the way the filter works.
Comment #246
m.lebedev commentedI agree. However, there are requirements when needing to ignore limits. It would be great if the settings had the option to turn off the limit. The developer consciously makes a choice by disabling limits.
Comment #247
andypostRelated issue landed in 8.8 so limit could be used from the field settings
Comment #248
gbirch commentedPatch #240 applies cleanly to 8.7.9, but when added to a view on a user reference field (that uses entityreference view as a source), I get:The handler for this item is broken or missing. The following details are available:with no further information.The patch applied successfully, but put some files above the document root. With that fixed by hand, it Is now working fine. Sorry to bother you!
Comment #249
damienmckenna@gbirch: did you clear/rebuild the site's caches after applying the patch?
Comment #250
gbirch commented@DamienMcKenna - overlapping edits. See above. Thanks!
Comment #251
damienmckennaNo worries, the composer patches process gets a bit wonky sometimes.
Comment #252
kasey_mk commentedI agree that "Maximum entities in select list" should not be required. A warning in the description will allow developers to use their own best judgement for their own circumstances.
UX can be made more friendly with tools like the Chosen module.
Comment #253
heddnLet's move the latest patch as the latest upload... Here's the patch from #225.
Comment #255
superfluousapostrophe commentedI am having an issue with the #225 patch - I'm not 100% clear on how to explain it (or even if it's directly related to the patch), so here goes:
I have a view which shows a table of Orders to a user, restricted to the vendor or vendors that the user has access to. I am trying to create an exposed filter on that Order view which uses an Entity Reference View to display the vendors available to the user in a select box.
Whenever I go to add the filter, I get the following error in the ajax response:
I am running 8.8.0. I'd appreciate any help on this.
Comment #256
jastraat commented#225 worked for our purposes against Drupal core 8.8.0. (It did not apply cleanly however.) #253 did NOT work for us.
Comment #257
wstocker commentedConfirmed #225 applied against Drupal core 8.8.0, but we are getting the same error mentioned in #255.
Comment #258
c.e.a commented#225 did applied against Drupal core 8.8.0, but we are getting the same error mentioned in #255
So basically the patch is not working and there is no working patch for Drupal Core 8.8.x.
Any help please ?
Comment #259
Drutech commentedAny help please on this issue !
Not a single patch available here is applied and working on my 8.8.0 site.
can someone with enough experience fix this issue ?
@_Archy_
Comment #260
heddnWhen patch is used in combo with better exposed filters, you can no longer rewrite the options. Basically, there are BC concerns with what is going on here. It is BC around expected form structure, which form structure is explicitly called out as a internal. So it can be done, its just that the CR should discuss that edge case and that views will need to be adjusted if they are using BEF and rewriting options.
Comment #261
c.e.a commented@heddn I affraid the Better Exposed Filter module does not have any conflict while used with this patch as because the patch #225 or #253 both are generating the below error even while the Exposed form style for filters is set to Basic with in the view.
Note: I am running Core version 8.8.0
Error:
TypeError: Argument 2 passed to Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection::getDisplayExecutionResults() must be of the type string, null given, called in /home/####/public_html/####.com/web/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php on line 243 in Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection->getDisplayExecutionResults() (line 266 of /home/####/public_html/####.com/web/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php) #0...Comment #262
kasey_mk commentedEDIT: Sorry, I realized I made a mistake and this patch only includes new files, not edited ones. And of course I've thrown away my workspace since then. :(
#232 had been working for us before updating to Drupal 8.8.... but for the life of me I can't figure out why/where we were using it. Everything I touched on the branch where I added the patch from #232 seems fine without it.
But before I figured that out, I re-implemented that patch against 8.8. So here that is in case anyone finds it useful.
Comment #263
kasey_mk commentedFor real this time, a re-roll of patch #232 against 8.8.x. With limits set to 1000 instead of 100, because when I needed this patch, 100 was too low.
Comment #264
c.e.a commented@Kasey_MK I have applied your patch #263 which applied cleanly but yet the same error mentioned in #261 persists.
Patch not working for me ! Thank you
Comment #265
gbirch commentedThe error in #263 is caused by the code at line 597 of views\Plugin\views\EntityReference.php, in the new function getValueOptionsCallback().
Specifically, it appears that
$entities = $selection_handler->getReferenceableEntities(NULL, NULL, $list_max + 1);should be
$entities = $selection_handler->getReferenceableEntities(NULL, 'CONTAINS', $list_max + 1);This is because getReferencableEntities passes the NULL on to getDisplayExecutionResults(), which itself requires that argument to be a string, for reasons that are not entirely silly.
@Kasey_MK, do you agree, and would you be willing to re-roll the patch?
Comment #266
scott_euser commentedWorking on this now
Comment #267
scott_euser commentedUpdated patch.
I do have a slight concern we are perhaps doing too much here? Should the whole limit thing be a follow-up / separate issue? It seems to be expanding the scope of just generalizing the TaxonomyIndexTid class. Feel free to disagree of course!
Comment #268
c.e.a commented@scott_euser thank you for your kind help !
Finally there is a patch working with no errors for Drupal Core 8.8.x
Patch #267 is working as expected
Comment #269
scott_euser commentedNo problem, but I think that the tests are failing though. It seems to be because the tests are now running against 8.9.x instead of 8.8.x and don't seem to do with the actual patch https://dispatcher.drupalci.org/job/drupal_patches/22994/consoleFull
Will see if just triggering it to re-run the tests helps.
On local they pass:
Comment #270
scott_euser commentedTriggered a run of #267 against 8.8.x now (though I tested locally against 8.9.x so not sure if that will work)
Comment #271
c.e.a commentedAfter further testing, Patch #267 is working for some views and generating an error on some other views.
Error Description:
TypeError: Argument 3 passed to Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection::getDisplayExecutionResults() must be of the type integer, string given, called in /home/####/public_html/my.valetop.com/web/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php on line 243 in Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection->getDisplayExecutionResults() (line 266 of /home/####/public_html/my.valetop.com/web/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php)Any idea on what it is going on ?
Comment #272
scott_euser commentedUpdated should pass tests against 8.8.x. Seems there is a rogue config not part of schema in one of the test view configs (core/modules/views/tests/modules/views_test_config/test_views/views.view.test_filter_entity_reference.yml), though not sure it is related to this issue or whether it should be in a separate issue scope.
Comment #273
scott_euser commentedRe #271 error:
TypeError: Argument 3 passed to Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection::getDisplayExecutionResults() must be of the type integer, string giveIs it possible that you have something left over from an old patch. If you resave your extra settings for wherever you have set a max number of entities, it should save them as integers. That error indicates something is saved as a string, but I don't see anything in the code that could lead to `list_max` being a string.
Comment #274
scott_euser commentedOkay tests now passing. Needs review I think before we work on last task 'existing configuration migration'?
Comment #275
mdolnik commentedI am getting the same error with patch #272
TypeError: Argument 3 passed to Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection::getDisplayExecutionResults() must be of the type integer, string given, called in var/www/html/public_html/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php on line 243 in Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection->getDisplayExecutionResults() (line 266 of core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php).This can occur on existing exposed filters created using old patches and newly added exposed filters. Steps to reproduce:
Reference MethodtoViews: Filter by an entity reference viewView used to select the entitiesSelect listinSelection typeMaximum entities in select listblankAn exception is thrown.
This is because
$list_max = $this->options['list_max'] ?? -1in\Drupal\views\Plugin\views\filter\EntityReference::getValueOptionsCallback()will not transform thelist_maxvalue to-1if it is an empty string since the null coalescing operator??will only work on NULL/unset values and not empty strings.This exception will not occur on the regular "Default" selection handler because
DefaultSelection::getReferenceableEntities()and other methods it calls do not have strict parameter types, butViewsSelection::getReferenceableEntities()callsViewsSelection::getDisplayExecutionResults()which has strict parameters which is what throws the exception on the string passed inint $limitparameter.Comment #276
mdolnik commentedAdded fix regarding comment #275
Comment #277
scott_euser commentedThanks, good spot! It seems your patch contains quite a few more changes than your interdiff shows (looks like an auto format on save). I applied your change to #271 and attached an interdiff from both that and from your #276. This patch fixing the missing closing } of the class which was causing the linter fail / fatal error so tests can now rerun.
Comment #279
scott_euser commentedLooks like a completely unrelated failure related to some change to media library.
Comment #280
dwwRe: #279 -- yeah, I think that's at #3066447: [random test failure] Random failures building media library form after uploading image (WidgetUploadTest). Re-queued #277 for testing. Let's see if it passes this time...
Comment #281
scott_euser commentedNice, thanks! Tests passing.
Comment #282
scott_euser commentedStill eventually needs config update but general functionality needs review before doing that I think.
Comment #283
wstocker commentedConfirming that #277 was applied against Drupal core 8.8.0 and this resolved the error we saw in #255.
Comment #284
superfluousapostrophe commentedThe patch in #277 applies cleanly via composer in 8.8.1 and seems to solve the problems I was having. Thank you!
Comment #285
damienmckennaSome details of my testing of #277 on a new site that didn't have the patch applied previously..
I think the problem is that the exposed filter's options change like so:
I would suggest the backwards compatibility needs to be improved to avoid this problem.
Comment #286
scott_euser commentedThat sounds like the 'existing configuration migration' remaining task from the issue description, but as per my comments above shouldn't we first get review of the general approach before we spend time on the upgrade path?
Comment #287
kasey_mk commentedThanks so much for everyone's work on this. After coming back from a holiday and re-discovering the use case I had for this patch, I am relieved to find that #277 has been made and works for me.
Comment #288
costellofax commentedIn case anyone else runs into this--for us, #277 applied cleanly on 8.8.1 but, when used with search_api 8.x-1.15 and search_api_solr 8.x-3.8, it caused taxonomy term reference exposed filters on indexed content views to throw:
Notice: Undefined index: entity_type in Drupal\views\Plugin\views\filter\EntityReference->getFieldStorageDefinition() (line 62 of .../core/modules/views/src/FieldAPIHandlerTrait.php)and
Error: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 150 of .../core/lib/Drupal/Core/Entity/EntityTypeManager.php).Comment #289
colan#286: Let's set to RTBC to get a review from the core committers before proceeding with the migration work. They can set it back to NW with feedback.
Comment #290
gambryI believe asking an initial review is understandable, but probably we should also flag this currently requires both an upgrade path and a change record. Besides as it is affecting at least 3 subsystems (node, taxonomy, views) and may affect quite few drupal instances probably a framework manager approval would be beneficial too.
I'm not sure RTBC is the right status, as we all now this needs still work, but because general consensus is to use this status to gather attention then ...It's better to ask forgiveness than permission. :p
Comment #291
gambryAdding approval and change-record requirements to the IS tasks.
Comment #292
scott_euser commentedLove this! I think 'Needs review' is probably already stretching it enough since, as you say, we all know it needs further work.
I think we maybe need to consider the functionality in general a bit more as a group though anyway. While this does provide the ability to for instance have nodes in a select list on a view (which is why I assume most people would like this feature):

I cannot see how we provide an upgrade path from a text field (which is probably not very useful, but that is beside the point):

With only these options available with the patch applied:

Should we not continue to allow that status quo and let site builders consciously decide to make use of this as a new feature? When I look at https://www.drupal.org/project/verf I see their approach was to create it as a separate option in the list of possible filters to add:

Comment #293
Mokshit06 commentedSorry this is an incorrect interdiff file.
Comment #294
Mokshit06 commentedThis is the correct interdiff file for comment 267 and 277
Comment #295
scott_euser commentedAfter discussion on slack in the #contribute channel, lets reduce the scope of this to adding the EntityReference views filter only to avoid the breaking changes and challenges outlined above with migrating existing usage of the TaxonomyIndexTid filter.
The attached patch essentially removes the bits of the preceding patches that change TaxonomyIndexTid, yet still allows you to use entity references as views filters with the select, autocomplete, max limits (and potentially as checkboxes / radio lists for instance in combination with better exposed filters module).
I have tried to avoid any changes to the patches thus far and just reverting the bits that are beyond just the Entity Reference views filter.
I have updated a fair bit of the description and the title to reflect this - please have a look at the changes there too.
Comment #297
scott_euser commentedWhoops, missed one artefact relating to TaxonomyIndexTid conversion
Comment #298
scott_euser commentedNo longer needs upgrade path
Comment #299
ckaotikGreat work everyone! Love that this has gotten so much attention. I'm wondering when using the autocomplete widget, can we keep the query parameters to stay as id-only, instead of the current
&my_field=some+long+entity+title+(42)? It makes urls quite long and in case the widget is changed to select later on, makes existing urls invalid.Comment #300
stopopol commentedJust applied the patch smoothly on 8.8.2 and it nicely changed the text field into an autocomplete widget in my view filter. I played around with the select options and couldn't find any bugs so far. Everything works smoothly.
I think this can be commited.
Comment #301
ibullockPatch in #297 appears to break entity reference fields in use on Webforms. Entity reference fields on Webforms always report the referenced entity does not exist. Rolling back the patch causes them to work once more. This could be a webform issue, but worth noting for anyone looking to implement this.Never mind, issue seems to be something in node access.
Comment #302
capysara commentedWorked for me! I applied the patch to a fresh install of 8.8.2 and to an existing site on 8.8.1 (updating an earlier version of the patch).
Comment #303
scott_euser commentedGreat to hear its working. If one or two people in the community have a chance to review it would be great to get this to RTBC for maintainer review.
I think we can also remove these two bullet's from the issue description?
☐ get framework manager approval
☐ write change record
Since its no longer a change, I believe it now only needs release notes (+ the follow-up tasks listed like documentation).
Comment #304
nord102Noting that I'm currently using the patch from #297 and it applies cleanly and is working as expected.
I noticed some strange behaviour when using the patch from #297 in combination with changing the Reference method to Views: Filter by an entity reference view and specifying an Entity Reference view.
The view does work as expected on the front-end, but once that setting is set to the above, the view from the admin side is unreachable / results in a timeout error when attempting to navigate to the edit view page.
Wondering if anyone else has run into this or can reproduce this issue with the same steps as above.
Comment #305
gbirch commentedFolks, this patch needs to incorporate the work done in https://www.drupal.org/project/drupal/issues/2957376, which has already been committed to core, but which is not used here. Otherwise you can get views that can't be saved, WSOD, etc.
Comment #306
scott_euser commented@gbirch Can you please elaborate and provide steps to reproduce? It would be good if it is directly related to the addition of this new filter. Things related to other filters would probably best reside in a different (new) issue to keep this scope limited to its goal.
Comment #307
gbirch commentedUnder some circumstances, triggered by I know not what, other than that it has happened to me, a filter on a view will point to a vocabulary that does not exist, or is not loaded when needed. This causes fatal errors. The patch merely checks for the existence of the vocabulary object before attempting to call a function on it. You may wish to read the original issue. The patch applies cleanly over this patch, and it stopped the errors I was experiencing and returned the erring view to functionality.
I can't give you steps to reproduce, because the view in question is an elaborate beast that applies to a content type with more than 100 fields. Do with this as you like, but the patch is short, simple, easy to understand, and seems to work. It would be interesting to know if it solves @nord102's issue.
Comment #308
stopopol commentedAfter applying the patch, the view worked fine for a while, but after an update using composer (i think this is when it started) I get this error message:
Drupal\Component\Plugin\Exception\PluginException: Plugin (entity_reference) instance class "Drupal\paragraphs\Plugin\views\filter\EntityReference" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 97 of /var/www/drupal/web/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).
When I have a look at web/core/modules/views/src/Plugin/views/filter/EntityReference.php everything's there.
This causes the view to return a WSOD and I can't even edit the view anymore.
Also when I try to add a new view and recreate this, I get this error message as soon as I try to add the filter.
This might be the issue described in #305 or it might mean that the patch doesn't work for core 8.8.3. I can't narrow it down.
Any ideas on how to fix this?
Comment #309
brandonratz commentedI am having the exact issue @stopopol mentioned. Also the patch #297 had been applied for some time and now when upgrading to 8.8.3 the view is now failing.
Drupal\views\Plugin\views\query\Sql->execute() (line 1543 of /app/web/core/modules/views/src/Plugin/views/query/Sql.php).Currently, the only way to edit a view which uses this exposed entity reference source is to DISABLE the view being referenced.
EDIT:
The error appears to be from NOT setting "Maximum entities in select list". When I added a value here, the errors went away.
Comment #310
murzI got same problem when NOT setting "Maximum entities in select list", the source of failing is wrong LIMIT in SQL query:
Comment #311
murzI fix problem when NOT setting "Maximum entities in select list" via setting
0instead of-1in$list_maxvalue, patch is attached. With this fix - MySQL errorLIMIT -1 OFFSET 0is disappear. @brandonratz, can you retest your issue with my patch?Comment #312
vasikequick check on #311 - it doesn't work for "Required" option
No valid values found on filter:+ It doesn't filter properly - as i got no resultsEntity reference node to node ...
Updates: So direct reference it seems it "works as designed"
The issues are for Entity reference field with "Relationship".
Updates2: please Forget about `Relationship` issue (my fault - i was missing something).
Other issue is for "Required" and no "Selected content items" ... i think it could from what it founds.
Anyway if there are too many then i don't think the required option is selected ... and also it's not selectable from "1802" options ...
Comment #313
shabana.navas commentedI am wondering how we get the autocomplete to display for a custom entity which has references to other entities. My custom entity has a reference to a Commerce Product Variation and Commerce Product. Right now, it doesn't give me an autocomplete or select list option for these references. Do we have to do anything programmatically to enable this feature for custom entities?
This is a must needed patch. Thanks for all the hard work.
Comment #314
vasikeSo tested more #311 and it seems it works as "designed"
I also updated my previous comment #312 - so the only thing it's "Required" for All References ... which for sure it's another issue ... but good to know
Comment #315
johnwebdev commentedCode review. Here's a start.
Can be removed.
Can be removed.
auto complete => autocomplete
Not sure we can use return type declarations? I know there is a issue on this somewhere though.
According to our schema this should be a integer and cannot be null.
Why do we need Html::escape here?
Can we add further documentation to explain what's going on here?
Is this a typo (#ajax = FALSE) or intended? Can we clarify with a comment what we're doing here.
Comment #316
jantoine commentedThe latest patch in #311 has a performance issue that is most likely attributing to those experiencing the WSOD. I ran into this issue when trying to update a view that was using the previous patch from #71, but was also able to reproduce when deleting the filter completely and re-adding it to the view.
The issue occurs when a filter is being added for entity reference fields where a large number of entities already exist for the referenced entity type. To reproduce, create 10,000+ entities of a given entity type and then attempt to add an entity reference filter to a view for a field referencing that entity type.
The cause of the issue is not having a reasonable default value for the 'list_max' option. Using a default of 10 adds the filter quickly returning the configuration form where the 'list_max' value can then be altered.
Comment #317
sagesolutions commentedI am also having performance issues with patch #311.
What is strange for me is that other views that do not include any entity reference filters are also periodically seeing a WSOD and memory usage errors.
I'm wondering if this patch is effecting all views, not just views that use the filter.
Comment #318
sagesolutions commentedUpdate:
So it turns out my one of my blocks in an view has a filter on a multi-valued field which is checking if that field is not null (empty). Removing this filter also removes the WSOD.
This is most likely unrelated to the entity reference filter, but it did start happening at approx. the same time as I added the #311 patch.
Comment #320
rockaholiciam commentedThe patch in 297 does not seem to work for entity references that are predefined in code as part of custom entities and not created via interface.
Comment #321
rockaholiciam commentedInfact, it seems any special handling of views filters for fields that are defined as part of entity in code is being ignored. Tried to add one for daterange and it too doesnt work for the field defined in code but does work if I add another via interface? Anyones got any idea why this is so?
Comment #322
berdirSee #2652010: [meta] Make configurable and base field integration in views more consistent and specifically #2337515: Allow @FieldType to customize views data, related but different issue that can't be fixed here.
Comment #323
scott_euser commentedThanks for the code review @johnwebdev
1. Removing nullables from config schema
Removed as suggested
2. Removing translatables from config schema
Removed as suggested
3. Auto complete should be autocomplete in comment
Comment fixed
4. Return type declarations
From what I can see, since minimum required version is php 7.0.8, this is available, though it is being discussed here. Not sure if its safer to remove for now or leave in as it has no ill effect?
5. list_max schema is integer so should not be ''
Good spot - updated to be '0' which matches now the default for SelectionInterface. I have updated the field description accordingly
6. Use of Html::escape()
I have removed though I am not fully confident about it; could it be because a Label could potentially cause an issue as an array key if it has special characters?
7. fixSubmitParents and fixSubmitParentsElement documentation
I have added back in the comments from the original addition of that to the code. Full disclosure, I did not attempt to get my head around what the issue was when it was added.
8. #ajax false mixed in with #access false
Actually this appeared to be required. The handler list of entity bundles to allow does not show up without it. I have separated it from the display changes (#access) and added a comment.
Additionally:
I have set the default list_max back to 100. It appears not having this has caused user's of the patch a bit of grief. I think better to have user's consciously decide to remove the limit. This avoids the risk of a WSOD immediately within the views preview if the user does not make a choice.
Comment #325
scott_euser commentedAdded return typehint to test for D10 compatibility
Comment #326
honyik commentedHello, how does one actually use this? I've been using this module: https://www.drupal.org/project/entity_reference_exposed_filters but the update to core from 8.8.4 to 8.8.6 has broken it. I suppose that changes made in this thread made it to the core code? If so, how do I implement this? I've applied the 325 patch and I've search for the filter field "Content: content" as per the description of this issue and I can't find anything, can anybody advise please? I don't need anything too fancy, just an exposed filter containing titles of the nodes referenced by the displayed nodes. Thanks a lot
Comment #327
scott_euser commentedIf you installed with composer, you can apply a patch using this https://github.com/cweagans/composer-patches/blob/master/README.md (you could find tutorials by searching for "composer patches drupal" for instance). You could alternatively use
https://www.drupal.org/project/verf which may serve your purpose.
Via this patch, if you for instance have a field_organisations, which is an entity reference for an Organisation node bundle, you would add the filter for field_organsations to the View and, in additional to the option of displaying as an auto complete input field, with this patch you can also choose to make it a select box (or with Better Exposed Filters module a series of checkboxes or radio inputs depending on single or multi-select).
Comment #328
honyik commentedI knew how to apply the patch, but didn't know how to set up the view, I do now, thank you very much :)
Comment #329
aswathyajish commented#297 worked for me. Thanks.
Comment #330
ivanaldavert commentedHello folks,
I got
"Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2020-02-08/drupal-generalize-taxonom..."
on 9.0.1,
any clue?
Thanks!!
Comment #331
krzysztof domański@ivanaldavert You are using an older patch #297. In the meantime, something has been commited so the old patch is not applying in the new version of Drupal 9. Try applying one of the recently added patches. I have not tested them and there is no guarantee that they will work as expected. It may still require additional work. Read previous comments.
Good luck!
Comment #332
scott_euser commentedCan use #325 latest, it's effectively the same but updated code to match drupal 9 and addresses a few minor tweaks from code reviews. Functionality is the same and structure is the same so no upgrade needed from 297 to 325, just replace the patch.
Comment #333
ivanaldavert commentedHey Krzysztof,
- Installing drupal/core (9.0.1): Downloading (100%)
- Applying patches for drupal/core
https://www.drupal.org/files/issues/2020-05-23/drupal-generalize-taxonom... (Add Views EntityReference filter to be available for all entity reference fields)
Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2020-05-23/drupal-generalize-taxonom...
It happens the same with the last patch...
Comment #334
krzysztof domańskiRe-rolled.
#2824935: Fix Squiz.ControlStructures.SwitchDeclaration coding standard was commited and
core/modules/views/views.views.inchas been changed. The same file has been modified in the last patch but re-roll was not necessary. The automatic test fails if the patch cannot be applied but has passed successfully.@ivanaldavert It looks like you have a conflict with patches. Probably another patch also modifies the same file. Check other patches that modify the views or views_ui modules.
Comment #335
ivanaldavert commentedHi,
I just have one patch, I just tried with the last one but still not working... should I reinstall something?
Thanks!
Comment #336
krzysztof domański@ivanaldavert Delete the
core/directory and reinstall it. It looks like the previous patch was not fully applied or something.Comment #337
ivanaldavert commentedDeleted the core but still not working with the latest patch... any idea?
Comment #338
cilefen commentedhttps://www.drupal.org/files/issues/2020-06-21/2429699-334.patch applies to all versions of Drupal 9.
If you are on a system with the right utilities, output of the following would be interesting to see:
Comment #339
ivanaldavert commentedThis is the output:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
9 44744 9 4104 0 0 77433 0 --:--:-- --:--:-- --:--:-- 77433
curl: (23) Failed writing body (1363 != 1371)
am I missing something there?
Comment #340
cilefen commented@ivanaldavert
I am sorry to hear you are still having issues. It seems the patch utility may not be installed on that system. It could be https://github.com/cweagans/composer-patches/issues/316, assuming you are using cweagans/composer-patches.
But a general inability to patch is out of scope for this issue and this conversation is noise for the > 200 people following it. If you continue to have problems patching it will be better if you work that issue at https://github.com/cweagans/composer-patches.
Comment #341
ivanaldavert commentedIt looks that my sistem had an error and the patched was not applied. Now works perfectly, thanks guys!
Comment #342
stopopol commentedI just cleanly applied the patch in #334.
So far I haven't found any issues with it.
EDIT: As far as I can tell, the patch also applies to Core #8.9.2
Comment #343
c7bamford commentedEntityReference->getValueOptionsCallback defaults to loading every entity. This seems incorrect. Also, it breaks views_ui on my site. I have tens or hundreds of thousands of entities. Perhaps countReferenceableEntities should be used instead of getReferenceableEntities, then if the count is over the limit, switch to an autocomplete.
Comment #344
stopopol commentedThe patch in #334 doesn't apply to 8.9.3 anymore.
Comment #345
c.e.a commentedPatch #297 applied cleanly on Drupal Core 8.9.3
Comment #346
stopopol commentedThe patch in #334 cleanly applies to 8.9.4, 8.9.5 and 8.9.6
Comment #347
david.qdoscc commentedPatch #334 is also working for me on 8.9.6 along with Selective Better Exposed Filters to only show titles that appear in the result set :) Nice!
Comment #348
heddnI feel bad about this, but I'm getting schema validation issues on a site with this patch applied. I think (hope) it should be a quickfix to update the config schema.
Comment #349
berdir@heddn: I assume that's existing views that had those entity reference fields already as filters? That's not easy to fix, because with this, the old structure becomes invalid.
Comment #350
heddn@Berdir, it sure was cruft. I guess that should be fodder for any CR that gets added. Backs to NR.
Comment #351
mparker17I noticed that the patch in #334 no longer applies to
9.1.x, so I've re-rolled it (and tried my best to fix the merge conflict). Since this is a re-roll, generating an interdiff is not useful (and somewhat difficult), so I'm not including one.For your convenience, I re-rolled #334 on the latest
8.9.xand9.0.xtoo, and I'm including them as.do-not-test.patches so Testbot doesn't get too angry.Comment #352
OthmanEmad commentedPatch #351 for the 8.9.x version worked perfectly on 8.9.6.
Great work!
Comment #353
avpadernoComment #354
mparker17As @heddn noticed in #348 even newly-created views seem to be writing
handler_settingsandhandler_submitkeys to the config.It shouldn't be writing
handler_submit(we don't need to store the nojs submit button text as configuration!), andhandler_settingsshould have a schema.Here's an updated patch to fix those issues.
Comment #355
heddnIt seems to be like we need better test coverage then, if we have config schema errors that aren't getting caught.
Comment #356
playful commented#354 is not working with Chosen, which works fine on entity reference select lists outside of Views exposed filters.
Comment #357
colan#356: Please create a follow-up issue for that (unless there's one already) as this issue has dragged on long enough. We can't keep expanding the scope.
Comment #358
dwwThanks to everyone who worked on this so far! It's really coming along, and looks close to being ready. It's definitely going to be a big win for Views! Excited to try to help get this in.
First deep dive of the patch, and I found a bunch of mostly cosmetic issues with comments and code style.
Probably the biggest question of substance is if we want/need the
list_maxsetting (and all the related complications) at all. Due to how it works, if you're over the limit, you already had to pay the RAM + query price. So while it saves you from an unwieldy UI and a huge select in the page output, it doesn't help you much on the back end. I'd be in favor of a the simple toggle between select + autocomplete. If a site builder uses 'select' and the list is too big, that's their problem, not ours. If so, we could remove a lot of complication and code in this patch.Anyway, here's the full dreditor review...
"in case" what? ;)
"for setting messages" isn't needed.
If we could inherit the _construct() docs from our parent, we wouldn't need this function at all. ;) The parent only takes 3 args. So we need a real docblock here to document the additional params.
Can we define the return type as void? Or not, since it doesn't have it in the parent?
a) Should start with 'Gets'
b) "the used" is a little awkward.
Maybe:
"Gets the entity reference selection handler in use." ?
maybe just leave out the '...' here and end this comment on the 1st line?
This is a little worrisome. ;) Is there a more elegant way to fix it? Can we open a follow-up to track this? It's not obvious what "doesn't get processed correctly" means, so it's not clear what this hack is working around, etc. If not a link to a follow-up issue, can we give this comment more detail?
Also, in comments, AJAX should be all caps as an acronym.
Reading #2854166: Add #group handling to Select form/render element, it looks like #2190333: Make #group FAPI / render feature work on all form/render #types out of the box is probably going to be the real solution here. Probably better to use 2190333 for this link.
Note to self: why do we need this?
In comments, s/ajax/AJAX/
This isn't very helpful as a 1-line summary. I think I'd remove this entirely and use the 'Processes the ...' thing as the summary.
Not sure what 'and allows access to the form state.' is talking about. Looking at this function and what it calls, I don't see anything about form state at all...
More of the same. I'd remove the generic summaries and use the more specific descriptions for each of these.
That doesn't look like what this function really does. ;) More like 'Changes the parent of submit buttons on the field settings form because X...', right?
Again, what's "form state" have to do with it?
So if we have a huge # of options, we still have to query/load them all, only to count them and decide if that'd be too expensive and we want autocomplete, instead?
Is all this list_max setting and functionality even worth the complication? Maybe we just have the widget setting and let site admins shoot themselves in the foot if they try using 'select' on something huge?
'Adds an autocomplete...'
Can declare
: voidreturn type.Either we don't need the local var and we call getReferencedEntityType() twice, or we use the local var for both. The current mix is weird.
Maybe worth a comment here. Curious: why not validate the reference?
s/ValueForm helper adding/Adds/
Not required, but I'd love a comment about what's happening here.
Why do we force this min #size? Probably worth a comment.
Not obvious why this is needed at all. Can we rip it out? If not, can we add a comment about it?
Maybe: "Returns the value options for a select widget." or something? 'Value options callback' doesn't follow standards and isn't very descriptive.
This doesn't appear to validate anything, and it used only to copy values from target_id into something else. Maybe worth a comment?
You don't technically need the outer if(). If $values is an empty array, foreach() becomes a no-op and $ids remains empty.
Not sure what $rc stands for. "Return code"? Maybe $result would be more self-documenting?
Not clear why. Don't we want/need to validate autocomplete values, too? Does anything stop end users from putting bogus entity IDs in this filter?
getValue() isn't really validating anything, either. ;) I confess this function isn't making much sense (but I'm also sleep deprived, so maybe I'm just being dense).
Huh? Is this saying we don't call the parent to avoid an array_filter()?
Maybe add @see pointing to the parent valueSubmit() we're worried about?
So this valueSubmit() is a total no-op? Isn't that a problem? ;)
Also, it's convention to include () after function names in comments:
array_filter()...It's not just the ID, it's the fully loaded EntityType object.
Sadly, our doc standards basically want us to duplicate the summary here. ;) But "Entity type" isn't much help on its own.
A) Not necessarily 'select'. Maybe "Use the entity_reference filter for this field." or something...
B) Looking at this hunk in context, it's weird that it's between the relationship and reverse relationship cases. Seems cleaner to either put it near the top of the loop (right after we test for instanceof ContentEntityTypeInterface), or at the very bottom.
C) Given this change, we should consider updating the comment for the function to mention it's mucking with filters, not just relationships.
Not clear why we need this. If we do, why didn't we need it before? ;) If we don't, what's it doing here? Seems this wants to be removed, or it wants a comment to justify itself.
Stopping here and saving review so far. I'll come back for reviewing the test coverage ASAP. I'll also try running it locally, and seeing 1st hand how it behaves.
Thanks again!
-Derek
Comment #359
dwws/Test/Tests/
Can remove 'referenceable' from here -- that gets its own comment. I'd rather know what entity type we're talking about here. The "host" entity type that the view is of?
Kinda weird the type is hinted as NodeTypeInterface. If we're hard-coding node, why bother with the protected member at all?
Also here.
All this terminology and the variable names are a little confusing. Maybe $hostNodes vs. $targetNodes would be more clear?
Or parentNodes vs. referencedNodes or something?
That's interesting. ;) So why is it in this test?
Could declare return type : void
This is a bit weird. Seems better to directly assert the nids (like we do for the labels) and let PHPUnit blow up if we're missing something or we didn't find them in the right order...
A) See https://www.drupal.org/node/3168858 -- we don't want drupalPostForm() anymore.
B) See #3133726: [meta] Remove usage of t() in tests not testing translation -- we don't want t() here.
This seems a bit fragile to depend on the ordering from adding these two arrays together...
Maybe we should, but I don't remember us using ` for comments like this...
Could declare return type : array
Why can't we call $option->getText()? This seems more complex than needed.
Cool. That's a start for test coverage of the views_ui parts of this patch. But there seem to be a lot of code paths (even in the admin UI parts) of EntityReference.php that we're not covering here. Additional test coverage we could use:
A) I wonder if we'd be better suited with a FunctionalJavascript test so we could actually see the AJAX stuff in action (since there are a fair bit of comments and code in the patch specifically for the AJAX cases within the admin UI itself).
B) This patch would be more RTBC-able if it also included a new test in core/modules/views/tests/src/Kernel/Handler to actually verify that the filter itself works for end users using a view.
C) For extra credit, we could also add something in core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler to see the autocomplete exposed filter actually working, too.
Thanks again!
-Derek
p.s. Moving the component to Views, since the "Entity Reference" module as such is going away...
Comment #361
nono95230 commentedI add to this question the same patch, compatible with version 8.9.7 of the drupal core, and compatible with version 7.0 of PHP.
Comment #362
kapilv commentedpatch doesn't apply. hear a updated patch.
Comment #364
anmolgoyal74 commentedHandled few points from #358.
Added Entityrefernce.php file.
Comment #365
scott_euser commentedFrom what I can see #361, #362, and #364 are not moving the issue ahead, but are so that people can use the old patch on older versions of Drupal/PHP. I'm going to work on #358.
Comment #366
playful commentedI just noticed that #354 has broken some of my existing views filters causing a "The operator is invalid on filter" error. On Drupal 8.9.
Comment #367
scott_euser commentedOkay here is an updated patch addressing comments from #358 and #359 (thanks very much for the detailed review and helping move this forward!). I can see that in #364 you have written 'Handled few points from #358.' so I put an interdiff, but I still based this on #351 as #364 re-introduces changes to the views wizard and taxonomytermtid classes and I believe we've already addressed that we need to keep this scope limited to have a realistic chance of getting it done. Would suggest any extending of EntityReference by TaxonomyTermTid and changes to the wizard be a follow-ups. Apologies if I've gotten this wrong!
I have gone with the suggestion of removing the list max option. Theoretically the same issue of memory can occur with any reference including taxonomy terms (existing) when switching from autocomplete to a full list. As @dww pointed out, we are anyways loading the entities to determine if the max has been hit (though I suppose we could load max+1 rather than all entities). In any case, it might be more suitable to have that in VERF or other contrib module to avoid slowing progress down on this issue.
Where the comment was clear, I've updated, but here are my notes on things that might be more contentious in the change:
Addressing review from #358 (functionality):
Addressing review from #359 (tests):
Comment #368
scott_euser commentedFixes for coding standards warnings, otherwise no change from #367.
Comment #369
scott_euser commentedUpdated patch now including a Kernal test.
Next steps I believe if someone else would like to continue:
Comment #370
aaronmchaleQueued #369 for testing against 9.2.x.
Comment #371
klaasvw commentedFirst of all, thanks everyone involved for pushing this forward! This is a much needed feature that is frequently requested, so having this in core would be great.
As already mentioned in #321, entity_reference base fields are not supported here. As #322 explained this is mainly a higher order issue, but until that issue is fixed we can still make sure base fields can also use this filter. Note that this is already the case for other views integrations, e.g. in
core/modules/views/src/Plugin/views/field/EntityField.php:167, where$this->definition['entity field']is converted to$this->definition['field_name'], so base field definitions are also supported as views fields.Updated the patch from #369 with support for base field definitions and also included a 9.0.x backport for those who need it.
Comment #373
avpaderno(I wonder why the status is not automatically changed when a patch fails to apply or tests fail, as it usually happens.)
Comment #374
dwwThanks for all the effort here since #359!
@all: I signed this issue up for forks, and created an initial branch here:
https://git.drupalcode.org/issue/drupal-2429699/-/tree/2429699-add-views...
We could keep the mainline effort in this issue in that branch, but create other branches for the backport patches. Ideally that will keep everything more clear, and make it easier to share our work. It's the way the future is going for core contribution, and we can now try it here and provide feedback on how it works if we run into anything. Sound good?
Would @scott_euser be willing to populate the above branch (and maybe put #371 as an additional commit)?
Would @Nono95230 and others working on the 8.9.x backport be willing to create a new branch, then populate it?
I'll look more closely at the new patches in the meanwhile.
Thanks!
-Derek
Comment #376
scott_euser commentedThanks for setting that up @dww! I done the following:
Comment #377
webiator gmbh commentedWorks like a charm
Comment #378
dww@scott_euser Thanks for all the Git shenanigans!
I still haven't been able to carefully review all the code in here. But a $day_job project required me to investigate trying to use this for something. I ran into some fairly catastrophic problems. ;) Fearing it was weirdness from the test site, I tried with a clean copy of core, and ran into the same things:
A) On a site with a lot of content, if you just apply the patch and try to use it in a view, the site completely hangs. Before you can successfully configure the filter, the fallback behavior in
getValueOptionsCallback()ends up trying to load all the entities on the site (or something), the DB connection times out, and all is dead. I had to add an earlyreturn [];to that method to be able to configure the view at all. Once I actually configured the 'extra settings' (see below), I could remove the earlyreturnand then the filter started working.B) The AJAX behavior for the "extra settings" form is broken. If you change the "Reference method", there's a little AJAX spinner, but the form doesn't rebuild to use your new thing. So, e.g. if it starts on 'default', you try to change it to 'view', you can't select which view to use. You have to select 'view', pick something arbitrary from the content type checkboxes, save, click "Settings" again, *then* the new modal will let you select which ER view to use. Then you can save. Then your filter actually works.
C) I'm not totally clear why these are even settings. ;) I know the answer is "because someone will need that flexibility some day", but naive me asks: "why not just use all the same selection handler settings from the field configuration?" I can't initially fathom why a site builder would want the view filter to give you different options than the field itself supports.
I'm out of steam for the week, but I'll probably dive back in on Monday to try to more carefully understand where this is going wrong and hopefully upload some new code that resolves these problems.
Thanks!
-Derek
Comment #379
scott_euser commentedHi @dww,
Sorry for the slow reply on this! I have had a look and I think we have a fundamental issue that has occurred somewhere in the back and forth. The default for an entity reference field is Drupal\views\Plugin\views\filter\NumericFilter. This has different options then both the Autocomplete widget and the Select widget offered by the new Drupal\views\Plugin\views\filter\EntityReference filter. I don't think an update hook is going to cut it as the Autocomplete default from EntityReference doesn't offer an equivalent scenario as NumericFilter has more operators. This seems to be an issue going many patch versions back (spot checked a few).
To reproduce:
This results in this long list of operators that make perfect sense for a numeric field (less sense for an entity autocomplete, but doesn't stop it from having been possible, and therefore I believe we need to maintain compatibility):

If I understand how it works correctly, the change in core_field_views_data() changes the filter being used to our new EntityReference. I think what would make this simplest is allowing initial widget selection of:
Ie, adding back in Numeric.
If you do think that's the right approach, what I'm not sure of is how to avoid adding a significant amount of code to bring numeric in as an option. Any suggestions?
I think this is why other contributors added in the default maximum. I suppose the exact same could happen on a large site with tens of thousands of Terms as the TaxonomyIndexTid views filter also loads all entities, its just that that is far less likely to occur. Maybe we need to bring back the maximum with the assumption that its much more likely to be a problem with Nodes/other entities than it has been with Taxonomy Terms?
I'm guessing this is related to the above with the NumericFilter, so I think let's start with deciding how to solve that. Feel free to disagree, I haven't investigated this to see how/when it occurs.
Well imagine you have 2 different Node Types using the same Entity Reference field. The content types they allow selection of can differ I believe.
In any case, definitely a fair bit more work to go. Thanks for testing this out and helping move it forward!
Scott
Comment #380
en-cc-org commentedHuge thanks to all who developed, this filled a critical need for us. Patch #351 on 8.9.10 is working well.
NOTE: Even if 'expose this filter to visitors' was not selected, the patch modified all filters based on entity references. I'm not sure why you would need a drop-down or autocomplete for a non-exposed filter - was this expected?
Two of our views broke, due to the problem described in #379. We had a (non-exposed) field_district "is equal to" a specific node id, but with the removal of those numeric operators the filter became invalid. I was able to fix by filtering on ID (using a relationship) instead so all is well.
Other (non-exposed) entity reference filters did not break, but now had the new, unconfigured extra "settings". I selected the appropriate content type and left the default 'autocomplete', hoping to mitigate any performance impacts (we have a large site with many complex views). Just seems like extra overhead for a non-exposed use case.
Thanks again.
Comment #381
Anonymous (not verified) commentedFYI, for those who arrived here from a Google search looking for help on select fields on exposed filter for an entity reference field, this module could be an alternative while this issue is being resolved:
https://www.drupal.org/project/entityreference_filter
Entity Reference Filter was particularly helpful in the use case I'm currently working on, as the entity reference field uses an entity reference view. This helps them neatly tie together.
(Yes, I know that this comment doesn't relate to the proposed solution. I'm putting this here for those who can't wait on this issue or who are using an entity reference field that's linked to an entity reference view.)
Comment #382
czigor commentedReroll of #376 for 9.2.x.
Comment #383
czigor commentedComment #384
heddnLatest patch doesn't apply to 9.1.3.It does apply. Just temporary issues with gitlab.Comment #385
a.dmitriiev commentedI tried to make a patch for 8.9.x out from Merge request #18.
Comment #386
heddnThe MR branch doesn't apply on 9.1.4. Also doesn't seem to apply on 9.2.x.
Comment #387
sokru commentedReroll from MR18's latest commit
0b5b8313. Interdiff done with diff command.Comment #388
avpadernoComment #389
sokru commentedComment #390
scott_euser commentedSorry forgot to update after commits yesterday. MR now contains the typo fix and reroll fix.
Still there are some issues to address however. If @dww or someone else is able to further review. I've added some comments in #379 that I think need discussion in order to take next steps in further updating the MR. Getting there!
Comment #391
yepaWe've a view based on a custom content entity with taxonomy field reference.
I've applied the patch #389 on a Drupal 9.1.4.
And it works fine ! Thanks folks.
Comment #392
luksakHere is a re-roll against 8.9.x.
Comment #393
luksakSorry, made a mistake while creating the patch.
Comment #394
luksakIt turned out that I had an issue on my now computer. The patch in #385 applies perfectly! Sorry for the noise!
Comment #396
rho_ commentedI have a custom content entity that has a term reference created with BaseFieldDefinition on a 8.9.x install.
Can confirm patch #385 applies cleanly and works as expected.
Comment #397
mr.york commentedReroll last patch and little performance fix.
Comment #398
mr.york commentedReroll patch.
Comment #399
mr.york commentedAdd performance fix.
Comment #400
mr.york commentedFixed last patch. (Sorry, this is not my day :) )
Comment #401
mr.york commentedFixed TaxonomyRelationshipTest reroll.
Comment #402
avpadernoComment #403
scott_euser commentedIs the latest work against 9.3.x still what is in the merge request? Its hard to tell if the patches are for backporting only or if the intention is for that to be the new 'head'.
If latest is still what's in the merge request then its still needs review, with #379 questions pending to move this forward I believe. I'll set it back to that for now, but sorry if I got it wrong! (and if so, should we then apply a diff to get the latest work back into the merge request so we don't end up having two diverging sets of work).
Is there a better way to manage this? Eg, a separate issue to handle backporting to keep this issue focused?
Comment #404
kapilv commentedfixed Custom Commands Failed.
Comment #405
avpadernoComment #406
scott_euser commentedAs per #403 unless someone explains otherwise, setting back to needs review as the merge request still merges and passes tests fine. Patches seem to be for back-porting with the exception of #404 which is unclear what the interdiff is between.
Comment #407
pyrello commentedAt the top of this issue, there is a checkbox that seems to indicate that it handles configuration entities. However, doing a search through the thread, I see scant discussion of this aspect of the functionality. Also, in looking at the code changes, it seems like this is more focused on content entities. Also, in testing it against an entity reference field to a custom-defined configuration entity, I am not seeing any of the additional options show up that seem to be indicated.
Am I missing something?
Comment #408
kim.pepperComment #409
jacobbell84 commentedThe re-roll for 9.1 in comment 401 didn't apply and included some of the orig/rej files. I rolled a new one for anyone that needs it.
Comment #410
pyrello commented#409 did not apply for me against 9.19
Comment #411
jacobbell84 commented@pyrello, this was a reroll for the 9.1.10 release. If you're on 9.1.9 you can use the patch from comment #389. Even though it says 9.2.x, it works fine for 9.1.9, we had been using it for a while.
Comment #412
pyrello commented@jacobbell84 Ah! Thanks for the clarification. I misunderstood.
Comment #413
willpeps commentedUpdating #409 as patch version is different to my version (9.1.5) due to assertEquals being assertEqual
Here is what is in my version of TaxonomyRelationshipTest.php
Whereas the patch in 409 is expecting a different set of lines, which can be seen here:
Comment #414
klaasvw commentedAnother update of #409, taking into account that
assertEqualsis also used in the original code since 9.1.10.Comment #415
sershevchykPatch 413 works fine for me on Drupal 9.1.5. Thanks
Comment #416
colan#414 seems to work on 9.2.0 and our Behat tests are passing, but it seems like the MR is out-of-date.
Maybe:
I hid a bunch of old patches.
Comment #417
isa.belWe have a user role field on a view, after applying this patch it worked like a charm!
Thanks all!
Comment #418
nixou commentedIn #295 this feature was removed for taxonomy term reference fields.
As I need it for a project I'm upgrading to Drupal 9.2, I reintroduced the feature in the attached patch.
If you do not want to keep the feature for taxonomy term reference fields, just ignore this patch.
Comment #419
catchPosting an identical patch to #414 except with the typo that cspell doesn't like fixed. Haven't reviewed yet.
Comment #420
catchAnd a re-roll so it applies to 9.3.x
Comment #421
nickdickinsonwildereroll to remove some unicode conversion mess(?) (next/previous strings)
Comment #423
bramdriesenThe patch also needs a re-roll.
Comment #424
ankithashettyPatch in #421 needed reroll after #3116481: Convert EntityViewsDataTest from a unit test to a kernel test got in. Also changed
Drupal\Tests\views\Kernel\Handler\FieldEntityReferenceTest::$modulesproperty toprotected.Thanks!
Comment #426
yogeshmpawarWorking on it.
Comment #427
yogeshmpawarHope this will fix test failure & changed
$entity->label(); method to $entity->getLabel();Comment #429
yogeshmpawarReverting changes made to
$entity->label();.Comment #430
marcushenningsen commentedSubscribe +
Comment #431
volker23 commentedNone of the recent patches applies to 9.2.7 in my case. Neither #429, #424 nor #389 does. Do i need something else?
Thx!
Comment #432
bramdriesen@Volker23 That makes sense because the patch is targeted on the DEV branch and not any of the stable releases (tags)
Comment #433
volker23 commented@BramDriesen, i see now, thanks. I was successfully using the patch #351 on a production 8.9.16 and was trying to get this up to Drupal 9. Now i need to find a solution for the taxonomy filters we're using there...
Comment #434
bramdriesenYou can always re-roll the patch on a different branch/tag, fix the "conflicts" and create a patch with the result after you resolved the conflicts.
Comment #435
ldavidsp commentedComment #436
ldavidsp commentedComment #439
ldavidsp commentedPatch apply for Drupal 9.2.7
Comment #440
ldavidsp commented@Volker23 try patch 439.
Comment #441
bramdriesenBack to needs review for the patch in #429
Comment #442
volker23 commentedThanks a lot @ldavidsp! patch #439 works like a charm.
(I think I need to learn how to reroll a patch, when comparing #439 with #429, basically some tests seem to have removed and line numbers differ. I have no idea how to accomplish something like this...)
Comment #443
chucksimply commentedFor Drupal 9.2.8...
- Patch #439 would not apply
- Patch #436 applied but didn't work (broken handlers all over)
- Patch #429 applied and worked as desired. Thanks!
Comment #444
ruslan piskarovConfirming.
For Drupal 9.2.8 only patch #429 can be applied.
Comment #445
avpadernoComment #446
catch#429 applies to 9.3.x and 9.4.x, it's not clear what the purpose of #435 onwards was. Re-uploading #429 as a new patch so that DrupalCI can see it. It's very hard to keep track of this issue with 400+ comments, so please only upload new versions of the patch when absolutely necessary, and explain what the difference is (re-roll, or with an interdiff) when doing so.
Comment #447
dat deaf drupaler commentedPatch #446 applied cleanly on drupal/core 9.2.8 (disclaimer - incompatible with drupal/core-recommended if used in your composer.json).. look forward getting this merged into core.
Thank you everybody for working on bringing this amazing feature into the core! ***waving hands***
Comment #448
maximpodorov commentedDoes this patch really support fields which reference configuration entities?
Comment #449
berdirNo, that's impossible, content and config entities can't be joined in a relationship, config entities are not stored in a way that allows an SQL JOIN to work.
Comment #450
maximpodorov commentedBut we don't need joins for filters.
And what does this line mean in the task description?
☑ support for configuration entity reference
Comment #451
chucksimply commentedSo we've switched the ER filter's Value textfield widget to Autocomplete or Select. This is obviously ideal, especially for exposed filters.
But what about use cases where the Value textfield widget is still preferred (especially managing values for non-exposed filters). Would it not be smart to keep the textfield as an option? Maybe as a radio option under the initial "Selection Type" setting?
Comment #452
micnap commentedInterdiff between 439 and 446 for quick reference.
Comment #453
seanbThe reroll in #446 didn't apply to 9.3.x. Here is a new one.
Comment #454
ahaomar commented@seanB patch #453 only works fine with new views from scratch but not working for existing views. When going to change existing views it gave error
The operator is invalid on filter: Content: Users. also when going to delete that field so can add later we cant delete the filter too it show new error
An illegal choice has been detected. Please contact the site administrator
Could you and any advice how to fix that please?
Comment #455
scott_euser commentedThe comments in #451 and #454 I think reinforce that to get this over the line perhaps instead of changing the default, we add these as new options and maintain the existing option as is.
We could optionally of course set a new default to the autocomplete for newly created filters.
It would make it far simpler to get this functionality over the line.
I've described this more in #379. If someone could confirm that this makes sense as an approach I am very happy to do the work on it and get it there. Then hopefully with a final community review, it should be in a reviewable state for a maintainer to consider merging. Feel free to slack me in drupal slack if you want to discuss approach.
Comment #456
ahaomar commentedThanks @scott_euser, just one thing does this patch 2429699-453-9.3.x.patch have ever test with "drupal/core-dev" is that working with that?
Comment #457
kepesv commentedGreat, 2429699-453-9.3.x.patch worked for me.
Comment #458
jonathanshawI agree with you @scott_euser about #379, keeping NumericFilter for existing views. I would have select or autocomplete as the default for new views. I wonder if this might be the most back-compatible option even without the settings mismatch.
Comment #459
chucksimply commentedWait, so is 2429699-453-9.3.x.patch breaking existing views in core 9.3. I need to upgrade from 9.2 to 9.3, but need this patch functional. Any further notes?
Comment #460
m.stenta@ChuckSimply we are using 2429699-453-9.3.x.patch with core 9.3.3 in the farmOS distro: https://github.com/farmOS/farmOS/blob/e834a8c84e77a99407097b68325cc1dcc2... - automatic builds are working: https://github.com/farmOS/farmOS/runs/4879054942?check_suite_focus=true#...
Edit: I may have misunderstood your question. Thought you were asking if the patch works (it does) - but I can't speak to existing Views that might be affected by this patch.
Comment #461
chucksimply commentedThanks @m.stenta. Yeah I am wondering if existing views are negatively affected by the latest patch.
Comment #462
chucksimply commented@scott_euser - Regarding your comment #455, for what my opinion is worth... YES! I agree that adding autocomplete and select as options instead of replacing the default seems to be the best solution for integration in most uses, both past and going forward.
Comment #463
musa.thomashello I test the 2429699-453-9.3.x.patch, set the field, set the view, add exposed filter. On form entity I havn't got any exposed filter did i miss something ? I'm on drupal 9.3 with better exposed filter (set on basic for this view) idk if it change something.
Comment #464
ericdsd commentedPatch #453 works fine over core 9.3.5
Comment #465
ironsizide commentedConfirming patch #453 working well in core 9.3.5 for me.
Comment #466
rcodinaPatch on #453 works but I agree with @scott_euser on #455 because I experience the same problem described on #454 on existing views. Having to manually redo all affected views from scratch it's not an option.
Comment #467
alvarito75 commentedConfirming patch #453 working well in core 9.3.7 for me after upgrading from Drupal 8.9 and applying this patch.
Comment #468
smustgrave commentedWorked for me
Comment #469
jonathanshawWe are NW for #455
Comment #470
scott_euser commentedThanks for the feedback, at Drupal Dev Days I managed to have a sit-down about this with @lendude (thanks again!) and he also agreed avoiding the BC is likely the only realistic way of this getting in, so exposing this as an alternative rather than a requirement. Similar to the approach of having 'Grid' and 'GridResponsive' where we provide both options to avoid the breaking change.
Attached patch exposes the new reference option, leaving Numeric as the default:
This does mean if you already use the patch and want to upgrade use the code in the attached update-hook-2429699-comment-470-onwards-add-to-your-own-module.txt or your filters will be back to using the numeric filter.. Add it to your own custom module (not Views from core otherwise you will miss out on the next hook update and likely end up with a broken site).
Comment #471
scott_euser commentedAh missed changing Taxonomy Reference test back to expecting numeric as the default - that test will fail. Updated patch.
Comment #473
scott_euser commentedOne more bit I missed reverting in the existing tests.
Comment #475
scott_euser commentedWhat are the chances of randomString() actually being a key on config. Anyways reran without change and the randomString() was no longer an existing key. Tests passing on 9.4 and 10.0
Comment #476
scott_euser commentedUpdates/code cleanup:
Comment #477
lendudeJust looked through this, and it feels like the right approach to take the whole upgrade thing out of it. Any simplification will make this easier to land.
But, just by scanning through this, this still lacks a great amount of test coverage.
I've just picked some samples of test coverage we need, some of these might actually have some coverage and there is still plenty of logic in here that I skipped, so it needs more tests than those I picked out here. Also added some other things that I happened across.
Since there is no FunctionalJavascript test, none of the AJAX stuff here seems to have test coverage. And this seems like the most fragile part currently with some workarounds and forcing it to play nice in the Views UI, so it really needs good coverage.
lots of if's and switches, this all needs test coverage
That's a lot of if's, do we have test coverage for all these cases?
This is currently a D7 views bug, is this really relevant here?
do we really need a switch for this?
Are we testing this, are the two widgets interchangeable?
Do we have test coverage for this scenario?
Do we have test coverage for these scenarios?
Logic in here needs test coverage.
Logic in here needs test coverage.
Comment #478
scott_euser commentedThank you so much for the quick review! I'll work on test coverage today, so assigning to myself.
Comment #479
bramdriesenGreat work Scott ;-)
Comment #480
acbramley commentedI may be missing something but testing #476 on a client site I can't see this working for config entity reference fields despite the IS saying it does.
Looking into the code
core_field_views_datais still checkingif ($target_entity_type instanceof ContentEntityTypeInterface) {Comment #482
pebosi commentedI found this patch today, used it on 9.3.15 and its working for my content entities, except for the custom views handler. Thanks so much!
Comment #483
akalam commentedI have updated the patch on #476 to add support to "Content revision: Author" base field.
Comment #484
avpadernoComment #485
la558 commentedHello,
Thank you all for working on this.
I have to be doing something wrong or have to be missing a step, I don't see any difference after installing the patch.
> downloaded the patch: drupal-views-entity-reference-filter-2429699-483.patch
> added it to the 'patches' folder
> added its corresponding entry to the composer.json file
> run 'composer install' to success (I can see the additions to the /core/modules/node/src/NodeViewsData.php file)
I followed the above instructions:
1. created a new content type
2. added an entity reference to this content type
3. created a new view
4. added the entity reference field to the view
5. added the entity reference field to the filter
Result: nothing special, it looks the same as before installing the patch; I don't see the options, I don't see the " | settings" next to the filter, etc
What do you think I might be completely missing?
Many Thanks in advance!
Comment #486
scott_euser commentedOkay finally managed to get some time to work on this. To recap, after discussion with @lendude goal is to simplify as much as possible and remove need for upgrade path being a significant part of that simplification (handled in #476).
Views Selection Handlers now working
For #476 and earlier, switching views handler doesn't actually work because of sub-sub-forms (ie, views selection handlers are subforms of config handler extra, which is a subform of views). Sitting with @wim-leers trying to work this out one suggestion he had was to look into using states instead of ajax, to simplify that. This patch covers that; all selection handlers are now shown using states instead, making far less ajax.
Added functional javascript tests
However, there is still ajax happening using the wizard, so as @lendude suggested in #477, we need more test coverage. I have refactored the existing patch tests to share a trait for creating the test contents and added in a functional javascript test.
This still needs further tests to ensure everything noted in #477 is also covered. The tests now focus on the configuration, but we need to also test visitor usage of the exposed filters for instance.
Conditionally required fields within selection hanlders
In all prior patches and still in this one, required fields from the default selection handler (ie, you must select at least one Content Type) do not get validated as required or not. ConfigHandlerExtra does not support showing validation messages it seems - looking through plugins in core implementing it, none seem to actually have any need for that. Prior to switching to states, the browser validation would at least handle some cases; however, with this method, the browser validation fails given required fields would not be focusable, and again conditionally required via #states is also not supported via ConfigHandlerExtra. I would suggest those can be follow-up issues rather than blockers for this, given it means that failing validation means the selection handler is then not set, so no harm is done. You can see the two TODOs where I marked these attempts to use setErrorByName() and required via #states in case you want to try them.
Content revision: Author
Sorry @akalam (#483), I have left your change out, I think it further adds to the scope and perhaps is better placed as a follow-up if others feel its useful, otherwise as part of contrib. This seems to be already listed in follow-ups in the issue summary ("conversion of the "authored by" filter to use the entity reference filter")
ConfigEntityInterface
Similarly maybe that can be a follow-up as well @acbramley (#480). From my conversations with @lendude on this, the smaller the scope, the more likely this has a fighting chance of becoming a reality. I will cross it off from the issue summary as well for now.
Next steps
So some things need some further discussion but hopefully a step in the right direction for something that actually has a chance of getting committed. Looking forward to feedback.
Further tests still needed as noted above.
Patch not merge request
Finally, to note I have opted to keep this as a patch rather than MR, as each time I've updated the MR, others work from older patches and subsequent changes in the MRs have been discarded. So while we still have a hybrid situation with MRs and patches in this thread, will stick to the patch route.
Comment #487
scott_euser commentedAttached should fix coding standards issue to allow tests that are in place to run
Comment #488
scott_euser commentedUpdated form nesting to prevent double nesting of fieldsets for selection handler subforms within the options extra subform.
Comment #491
scott_euser commentedHmmm not sure why the test is failing. Passing locally. Another attempt, otherwise would appreciate if someone else can test running it - I am not very confident with the ajax request testing, with handler saving, and preview auto-updating my guess is local order of the two ajax requests is different than via the test runner.
Comment #492
scott_euser commentedIssue with validation not being applied is already an active issue it seems: https://www.drupal.org/project/drupal/issues/3163740 (ie, "Conditionally required fields within selection handlers" from #486
Comment #493
smustgrave commentedfollowing the steps in the issue summary.
I verified that a filter for an entity reference field is appearing.
Verified it works as a select list and autocomplete
Verified its actually filtering as well.
RTBC+1
I'd move it but appears the 9.5 branch isn't building so would want to see the test cases
Comment #495
jksloan2974 commentedComment #496
jksloan2974 commentedI have an Exposed Group Content filter set on a view. I am running Drupal 9.1.11. Patch #414 seems to be the only one that works. If I update Drupal to anything above 9.2 patch 414 fails.
Other patches apply at higher Drupal versions but the exposed group still is incorrect. I have attached 2 screenshots the first is the desired behavior with Drupal 9.1.11 #414 applied. The second is Drupal 9.4.5 #491 applied.
Comment #497
jksloan2974 commentedComment #498
jksloan2974 commentedComment #499
acbramley commentedWhen using the latest patch (#491) I get a PHP error when trying to add an entity reference filter:
This is on PHP8 so I imagine this is what's failing the tests too.
Comment #500
lefale commentedAfter applying the latest patch (#491), I started getting memory issues (i.e. PHP Fatal Error: Allowed Memory Size Exhausted) when trying to access some of my views through UI. Long story short, the problem was coming from the default configuration of the Views Entity Reference filter plugin, which had been cleared after an upgrade to Drupal 9.4.5. For some reason, the plugin was trying to load all taxonomy terms of all taxonomies, resulting in a memory exhausted exception...
I solved the problem by adding a constant and setting a default value to the 'list_max' widget in EntityReference::defineOptions().
Comment #502
asad_ahmed commentedMade changes as per #500, thanks. Please review.
Comment #504
highermath commentedThere is a good likelihood that the memory issues referenced in comment #500 are related to the documented memory leak issues with PHP 8.1.
Comment #505
smustgrave commentedPutting back into NR the failure appears to be a random javascript one.
Comment #506
adriancidComment #507
adriancidComment #508
adriancidComment #509
adriancidI don't know what happened to the previous empty messages.
I applied the patch from #491 in D 9.4.7 and is working for reference fields without problem, but I'm not able to add a filter for the workspace owner. I described the issue at #3319556: Owner view filter should be handled like a reference
Comment #510
muriqui commentedLooks like #502 accidentally removed most of #491, so re-rolling. Attached patch is just #491 with the changes from #500 added.
Also, referencing #2651418: Non-array values for #ajax which was also needed when I tested this patch.
Comment #511
graber commentedTried to add a media reference filter with this patch and..
Error: Cannot use a scalar value as an array in Drupal\Core\Render\Element\RenderElement::preRenderAjaxForm() (line 315 of /var/www/html/web/core/lib/Drupal/Core/Render/Element/RenderElement.php)So we need to cover more and not only nodes when setting ['#ajax'] to [].
I'll handle that at least plus make a proper MR so we can review easily.
Comment #513
graber commentedComment #514
graber commentedComment #515
graber commentedUnfortunately, I'm stuck here as
Drupal\Tests\views_ui\FunctionalJavascript\FilterEntityReferenceTestfails on dispatcher (the filter edit link seems not to be there on views admin UI after adding the filter) and passes on my local with the same core version and on the same branch.Can someone else run that single test locally?
Comment #516
catchIt passes locally. The most likely issue is the chromedriver version on DrupalCI being different.
Comment #517
smustgrave commentedDon't know much about chromedriver. It also passes locally for me.
Wonder if we can put a waitForElementVisible before attempting to click?
Comment #518
graber commentedwaitForElementVisibledidn't help,waitForElementRemoved('css', '.ui-dialog')also didn't help. Still passing locally. Setting this to review and someone needs to check the testbot.Comment #519
daniel.rolls@flightcentre.com.au commentedJust rolling an update purely for the validateExposed method.
In some cases, like when using Better Exposed filters with Grouped filters the values are not an array, and values can be anything like "All", "1","2" etc. In these situations the values are masked by the grouping.
For now, just validating $values is an array before we treat it is such.
Comment #520
avpadernoComment #521
medha kumariRerolled the patch #519 in Drupal 10.1.x.
Comment #523
graber commentedPosting diff of the last patch with the 2429699-entity-reference-views-filter-d101 head. Can you check it out and answer: What are you trying to do actually?
Moving this back to needs review and please anyone reviewing: ignore those patches and focus on 2429699-entity-reference-views-filter-d101.
Also included #519.
Comment #524
smustgrave commentedSeems to be the same error.
Comment #525
smustgrave commentedStill seeing the same error.
Also see it was tagged for change record which still needs to happen.
Will reach out for framework manager review.
Comment #526
smustgrave commentedAlso think I may know why the test fails on drupal and not locally
/admin/structure/views/nojs/handler-extra/content/page_1/filter/field_test_target_id_reference is locally
but in drupal I bet it's
subdirectory/admin/structure/views/nojs/handler-extra/content/page_1/filter/field_test_target_id_reference
Comment #527
smustgrave commentedLets try this.
Leaving in NW for change record.
Hiding files to avoid confusion
Comment #528
smustgrave commentedLets try this.
Leaving in NW for change record.
Hiding files to avoid confusion
Comment #529
graber commentedhttps://www.drupal.org/node/3338903 Here's a change record draft.
Not sure about it though as this is a new feature actually that doesn't affect any previous instances. Do we need a CR in such cases as well?
Comment #530
smustgrave commentedAdd small tweak to CR to include images.
So a CR is also useful to announce new features/major changes. So announcing users can use this new feature could be helpful for some.
Comment #531
catchThe issue summary currently mentions converting the TaxonomyIndexTid filter to be based on this, but this isn't done in the patch. I don't think we should do it here, already at a possibly record-breaking 530 comments, but I couldn't see a follow-up to do that in the related issues - would be good to create that if it really doesn't exist and link it from the issue summary.
Comment #532
smustgrave commentedThis gets any more comments I'm afraid my page won't load haha
Opened #3339738: Convert TaxonomyIndexTid to use new EntityReference filter
Comment #533
smustgrave commentedComment #534
lendude@catch asked me to look at this again, mostly the test coverage. The test coverage seems mostly good, but ran into some other issues.
Comment #535
graber commentedI'm afraid a few more comments and infra will break for good. Maybe we should close this and open in a new issue with a summary? We could also choose contrib approach I took with Views Date Filter, create a core readiness issue there and merge to core when ready? Some changes seem too big for a single issue and should be handled as epics with their own sub-tasks really, otherwise we're stuck for years and end users don't see any progress.
Comment #536
smustgrave commentedOpened up #3347343: Add Views EntityReference filter to support better UX for exposed filters and asked @catch or @lendude to take a look and see if we can close this one one out.
Moved over the changes in the MR and copied comment #534 as those need to be done.
Comment #538
psf_ commentedHi, I don't like add more noise to this issue but I think it's a related use case.
The module https://www.drupal.org/project/config_views allow create views that query configuration entities, and I can create a new view that result all taxonomy vocabularies, for example. If I add a entity reference display to that view I can't select it in a reference field to use the view how list options.
I can't because this:
File:
web/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.phpline 141 of Drupal 10.0.9.If I replace that code by:
I can select my view, but after saving the site break with this error:
I think that fail because views only work with content entities, not with configuration entities.
Comment #539
catchClosing this as a duplicate of #3347343: Add Views EntityReference filter to support better UX for exposed filters because this issue is crashing browsers at this point. Let's continue over there.
Comment #540
catchComment #541
catchComment #542
scott_euser commentedFYI committed to 11.x in the follow-up #3347343: Add Views EntityReference filter to support better UX for exposed filters
Comment #545
biancaradu27 commentedadd patch for 10.3.x
Comment #546
andyg5000We were using the patch from 545. After upgrading to Drupal 10.5.1, it still applied cleanly, but caused critical errors because it duplicated the <?php tag and rest of the code.
If you're seeing `Parse error: syntax error, unexpected '<'` remove the patch.
Just a warning for others that may be using it!
Comment #547
ngal commentedI run into the same issue as #546 is describing, when updated a project to 10.4 so I updated the patch. Feel free to test, its working as expected for me.
Comment #548
ngal commentedComment #549
xjmLocking issue to prevent further comments and patches from being posted. This was fixed in #3347343: Add Views EntityReference filter to support better UX for exposed filters and is available in all supported versions of Drupal core.
Comment #550
xjmLocking issue to prevent further comments and patches from being posted. This was fixed in #3347343: Add Views EntityReference filter to support better UX for exposed filters and is available in all supported versions of Drupal core.
The patch should no longer be necessary and should be removed before upgrading your site, although you may need to recreate your filter. As always, back up your site and data prior to upgrading.
Comment #551
xjm