This is a #2512702: Implement configuration UI follow-up. Configuration UI was added to the module, but it is responsibility of individual plugins to provide forms for their part of configuration.

See \Drupal\entity_browser\Plugin\EntityBrowser\Display\IFrame for example implementation.

Comments

slashrsm created an issue. See original summary.

slashrsm’s picture

Title: Implement configuration form for View selection display » Implement configuration form for View selection display (to set View and View display)
DeFr’s picture

Status: Active » Needs review
StatusFileSize
new2.08 KB

Let's fix this, given that it produces a Fatal error that's rather easy to run into.

marcoscano’s picture

Status: Needs review » Reviewed & tested by the community

Just stumbled on #2721827: Configuration form is missing for the View selection display plugin with the same mis-configured plugin ("View selection display") and had the fatal error mentioned there.

I can confirm that without the patch the error is reproducible and that the patch in #3 solves the issue.

Marking as RTBC

DeFr’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.13 KB
new1.03 KB

@slashrsm pointed out that Media ID was only correct for Entity Browser used to reference media entities, and that the actual field name depends on the entity type, which is a good point.

Attached patch tweaks the wording a bit, to try to get something more generic while still providing examples.

Status: Needs review » Needs work

The last submitted patch, 5: 2671816-5-config-form.patch, failed testing.

The last submitted patch, 5: 2671816-5-config-form.patch, failed testing.

DeFr’s picture

Status: Needs work » Needs review
StatusFileSize
new2.14 KB

Same as #5 but without the parse error.

slashrsm’s picture

Status: Needs review » Needs work
+++ b/src/Plugin/EntityBrowser/SelectionDisplay/View.php
@@ -75,4 +76,41 @@ public function submit(array &$form, FormStateInterface $form_state) {
+    // Get only those enabled Views that have entity_browser displays.
+    $displays = Views::getApplicableViews('entity_browser_display');
+    foreach ($displays as $display) {
+      list($view_id, $display_id) = $display;
+      $view = $this->entityManager->getStorage('view')->load($view_id);
+      $options[$view_id . '.' . $display_id] = $this->t('@view : @display', array('@view' => $view->label(), '@display' => $view->get('display')[$display_id]['display_title']));
+    }

While this is needed for the view widget it is not in this case. Any view display can theoretically be used here.

Otherwise looks great. Thanks!

DeFr’s picture

Status: Needs work » Needs review
StatusFileSize
new1.27 KB
new2.05 KB

Let's list all views display then. I think there's a few display in there that are going to cause some weirdness if chosen (Feed and REST Export for example will make the entity browser look strange), but as long as the site builder picks up an appropriate display it should work.

slashrsm’s picture

Status: Needs review » Fixed

Committed. Thanks!

  • slashrsm committed 77e1860 on 8.x-1.x authored by DeFr
    Issue #2671816 by DeFr, slashrsm, marcoscano: Implement configuration...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.