When creating the Entity Browser I am never asked what View or View Display to choose. I get the following error when trying to add an entity:
Fatal error: Call to a member function getExecutable() on null in d8/docroot/modules/contrib/entity_browser/src/Plugin/EntityBrowser/Widget/View.php on line 95

I noticed in the example module it has view and view_display paramaters:

settings:
      view: files_entity_browser
      view_display: entity_browser_1

Comments

albertski created an issue. See original summary.

slashrsm’s picture

Category: Bug report » Support request
Status: Active » Needs review

You need to create at least one view with the "Entity browser" display on it. You also need to make sure that the view includes "Entity browser bulk select form" field. It should appear in the entity browser configuration form when you do that.

Please check that and get back. I am aware that we lack documentation here. It would be great to have some kind of guideline on the widget configuration form. Any contributions in that direction are very welcome.

Thank you for evaluating Entity browser.

albertski’s picture

For some reason I was able to see the drop down in the Widget form to let me select the form. Not sure if it had something to do with me just setting it in the configuration and then going back to the form.

b2f’s picture

I can confirm that editing the setting manually with view and display like above get the view to show up (drupal config:edit entity_browser.browser.browse_files) where the entity browser is used.

Although I can't edit this setting from the Entity browser form, if I do, I get the op error:
Call to a member function getExecutable() on null in Drupal\entity_browser\Plugin\EntityBrowser\Widget\View->getForm().

Note that the entity browser config form breadcrumb's "General information » Display » Widget selector » Selection display » Widgets" "Display", "WIdget Selector" and "Selection" steps form are just empty.

I tried using Drupal Core version 8.0.6, I may need upgrading to fix the issue.

albertski’s picture

I'm not able to see the drop downs again to select the views. So every time I need to make a change I go to configuration management and export/make changes/import.

albertski’s picture

Category: Support request » Bug report
slashrsm’s picture

Category: Bug report » Support request

Could you share steps to reproduce this error?

I tried two scenarios (using 8.x-1.0-dev of entity browser and 8.x-3.x-dev of ctools, clean Drupal 8.2.x install):

- enabled entity_browser_example and ctools
- navigated to admin/config/content/entity_browser
- edited test_nodes entity browser
- navigated to the widget configuration step
- changed view in the dropdown
- saved
- made sure that the changes were saved in the configuration

- created new taxonomy view, added EB bulk form to it and created "Entity browser" display
- navigated to admin/config/content/entity_browser
- navigated to entity_browser add page
- created new entity browser (Single widget selector, iFrame display, No selection display)
- navigated to the widget config page
- selected the view that I created
- saved
- made sure that the changes were saved in the configuration

karens’s picture

Ditto on not being able to select a view. I followed all the instructions and do not get a choice of a view to select. I did all that without enabling the example module, so I finally enabled the example module and tried that way, but still do not get any option to select a view. Using latest dev of entity browser, ctools, etc on 8.1.1. So maybe Drupal 8.1 doesn't work?

slashrsm’s picture

It seems to be working with 8.1.x too. I suspect that something goes wrong when we call Views::getApplicableViews('entity_browser_display'); in \Drupal\entity_browser\Plugin\EntityBrowser\Widget\View::buildConfigurationForm(). "entity_browser_display" is a custom property that we added in the annotation for the entity browser display, which helps us finding views that can be used with the entity browser.

Since I can't reproduce would be great if somebody that can would step-debug this in try to get any clues. I am happy to help. Ping me on IRC if needed.

bassam’s picture

My problem seems to be that the view/display_id are not stored.

When I debug entity_browser/src/Plugin/EntityBrowser/SelectionDisplay/View.php in function "getForm" the following variables are NULL:

$this->configuration['view']
$this->configuration['view_display']

EDIT: It appears to be that I have to set the options as "iframe" and "no selection display" for this to work.

Any other options will result in that error.

slashrsm’s picture

Issue tags: +D8Media

Based on #10 tried reproduce one more time. Here is what I did:

- navigated to Entity browser add page
- On first step selected iFrame display, Tabs widget selector and Multi step selection display
- Left all except widgets parts on default values
- On widgets step I added 2 view widgets and one other widget
- Selected different view in each widget
- Saved

Configuration saved correctly. Here is the proof:

➜  ctools git:(8.x-3.x) dcdr cget entity_browser.browser.foo
uuid: 1f7f8f32-d98d-49dd-96f4-b05e1fcb55a8
langcode: en
status: true
dependencies:
  module:
    - views
name: foo
label: Foo
display: iframe
display_configuration:
  width: '650'
  height: '500'
  link_text: 'Select entities'
  auto_open: false
selection_display: multi_step_display
selection_display_configuration:
  entity_type: node
  display: label
  display_settings: {  }
widget_selector: tabs
widget_selector_configuration: {  }
widgets:
  698bd233-f4ce-4737-a608-b609c916a6fb:
    settings:
      view: nodes_entity_browser
      view_display: entity_browser_1
    uuid: 698bd233-f4ce-4737-a608-b609c916a6fb
    weight: 1
    label: view
    id: view
  8471cbff-9e91-431c-8647-ffb319058714:
    settings:
      upload_location: 'public://'
    uuid: 8471cbff-9e91-431c-8647-ffb319058714
    weight: 2
    label: upload
    id: upload
  1af73822-7041-4c92-836f-841526874dab:
    settings:
      view: files_entity_browser
      view_display: entity_browser_1
    uuid: 1af73822-7041-4c92-836f-841526874dab
    weight: 3
    label: view
    id: view
submit_text: Select

This should be obvious, but just to eliminate one potential issue. Make sure to press "Finish" on last step. Without that configuration won't be saved.

It would be great if someone that can reproduce could step-debug submit of the last step in config form and check what is happening with the values there.

DeFr’s picture

Category: Support request » Bug report
Priority: Normal » Major
Status: Needs review » Active

@slashrsm I think there was a misunderstanding in there from the beginning. To reproduce the issue, you need to set the selection display to "View selection display" (it's not about the view widget); if you use that, then you definitely should get some configuration to show up in the wizard to set up the applicable view, but you don't.

At that point, when accessing the entity browser, you're then presented with the aforementionned Fatal error.

Setting to major, because it seems to be a rather common mistake made, and it's also a crash that can occur when using the wizard only. (Came up quite a bit when talking about Entity Browser in DrupalCamp Nantes, seems like a few people tried entity browser, used View selection display as a default choice, and then were presented with the fatal error and assumed it meant that the module wasn't ready)

slashrsm’s picture

Title: View and View Display are never configured » Configuration form is missing for the View selection display plugin
Status: Active » Closed (duplicate)
Related issues: +#2671816: Implement configuration form for View selection display (to set View and View display)

This makes sense. Configuration form was not created yet for this plugin. There is an issue about that: #2671816: Implement configuration form for View selection display (to set View and View display).

This should be a nice task for someone that would like to get involved as we can basically copy the form from the View widget. Ping me on IRC if interested and need help to get started.