Problem/Motivation
Entity browsers are configuration entities. Currently we're able to change their configuration only by hacking YML files. This is not very convenient, specially for people that look at EB for the first time.
Proposed resolution
Let's implement configuration UI. One should be able to:
- set basic configuration for EB (label, description, ...)
- choose plugins for display, selection display and widget selector
- each plugin will provide form elements for own configuration which we need to display and properly save configuration values
- select and configure widgets
- widgets will provide form elements for own configuration (similar to plugins above)
Remaining tasks
- create mocks/wireframes
- write patch
- write tests
Comments
Comment #1
slashrsm commentedComment #2
jelle_sThis module seems very promising, but not very usable without a UI I'm afraid. Any idea on when it will be finished. Anything we can do to help? I kind of want to use this to use a view with exposed filters as an entity reference widget, but currently have no clue how to set this up.
If there's anything I can do to help, let me know and I'll see what I can do.
Comment #3
slashrsm commentedCheck default configuration in entity_browser_example module. That should help you to understand things a bit more. There is also an example with views in there.
Comment #4
slashrsm commentedComment #5
ericduran commentedOne thing I would mention even if the UI isn't in place documentation of the configuration to use to run in the config sync would be useful.
A simple yml file describing what belongs where aka:
```
name: test
label: 'Test browser'
display: standalone
display_configuration:
.......
```
If that could be added to this thread with multiple examples it'll make testing this module a lot simpler for people just getting up to speed with it :)
Comment #6
slashrsm commentedHere we go: https://github.com/drupal-media/d8-guide/pull/7
Any feedback welcome.
Comment #7
ericduran commentedSuper useful. Thanks.
Comment #8
slashrsm commentedI started working on this during Zurich sprint.
https://github.com/drupal-media/entity_browser/pull/126
Uses CTools form wizard. Some work has been done, but it is not there yet. I won't be able to work on it in next week or so. If anyone wants to grab it please do not hesitate.
Comment #9
CTaPByK commentedOk i do not hesitate :) and i start working on this.
Comment #10
CTaPByK commentedI make new commit on latest pull request for config ui. There is some changes for fixing ajax callback and widget weight.
https://github.com/drupal-media/entity_browser/pull/137
Comment #11
slashrsm commentedI tested it. Remove works. Weights are saved. We still need to save other stuff and I left a comment about entity list.
Comment #12
CTaPByK commentedI make another commit and i think saving widgets configuration now is ok.
https://github.com/drupal-media/entity_browser/pull/137.
Comment #13
slashrsm commentedI think that I fixed all of the problems. Pushed in my config_ui branch: https://github.com/drupal-media/entity_browser/pull/126
See last commit for changes: https://github.com/drupal-media/entity_browser/commit/a0fc2e6c4ad7704871...
I also added test for config ui and wile doing that found some more problems in EB. Fixes for that are also included.
Travis integration is not configured to run simpletests. Uploading patch to run it on Drupal CI testbot.
Comment #15
slashrsm commentedI committed test_dependencies and rebased.
Not sure how long it takes for D.o to update test dependencies registry.
Comment #21
eclipsegc commentedThis looks like the sort of thing that would benefit from configuration defaults. Take a look at implementing ConfigurablePluginInterface. You're most of the way there already just from what I see in the patch.
Otherwise the patch looks pretty good. I'll apply it and give more feedback shortly.
Eclipse
Comment #22
luksakI was able to get a config for a entity browser working using this patch. But the process seemed quite bulky. I had a lot of empty steps in the wizard and especially the step for selecting the widgets was quite confusing. Should I provide more feedback about this or is this currently not needed?
Comment #23
slashrsm commentedEvery feedback is welcome. I am aware there are lots UX issues.
I think we will commit this more or less as it is (in order to at least have something) and then improve in follow-ups.
How does this sound?
Comment #24
luksakMakes sense. The patch doesn't apply anymore. Here is a re-roll.
Comment #25
luksakComment #26
slashrsm commentedThis converts ctools from hard to a soft dependency. We should be good to go.
Comment #28
slashrsm commentedReadme update + attempt to fix tests.
Comment #30
slashrsm commentedComment #32
slashrsm commentedCommitted. Finally! Super exciting.
Thanks everyone!
Comment #33
killua99 commentedAfter install the latest dev version I'm getting this error. I ran updb and clear cache. What else could be?
The website encountered an unexpected error. Please try again later.
Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("machine_name", "step") to generate a URL for route "entity.entity_browser.config_translation_overview". in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 177 of core/lib/Drupal/Core/Routing/UrlGenerator.php).
Drupal\Core\Routing\UrlGenerator->getInternalPathFromRoute('entity.entity_browser.config_translation_overview', Object, Array, Array)
Drupal\Core\Routing\UrlGenerator->generateFromRoute('entity.entity_browser.config_translation_overview', Array, Array, 1)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('entity.entity_browser.config_translation_overview', Array, Array, 1)
Drupal\Core\Url->toString(1)
Drupal\Core\Utility\LinkGenerator->generate(Object, Object)
Drupal\Core\Render\Element\Link::preRenderLink(Array)
call_user_func(Array, Array)
Drupal\Core\Render\Renderer->doRender(Array, )
Drupal\Core\Render\Renderer->render(Array)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1)
__TwigTemplate_f2b10aacd526d21905d3c127325a2b29c3c993d1a37f166939b81a087632f262->doDisplay(Array, Array)
Twig_Template->displayWithErrorHandling(Array, Array)
Twig_Template->display(Array)
Twig_Template->render(Array)
twig_render_template('core/themes/classy/templates/navigation/links.html.twig', Array)
Drupal\Core\Theme\ThemeManager->render('links__dropbutton__operations', Array)
Drupal\Core\Render\Renderer->doRender(Array, )
Drupal\Core\Render\Renderer->render(Array)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1)
__TwigTemplate_26e36f6e4b118b9cf6b3e085812401856384518390923af3a54ddf7156b554e5->doDisplay(Array, Array)
Twig_Template->displayWithErrorHandling(Array, Array)
Twig_Template->display(Array)
Twig_Template->render(Array)
twig_render_template('core/themes/classy/templates/dataset/table.html.twig', Array)
Drupal\Core\Theme\ThemeManager->render('table', Array)
Drupal\Core\Render\Renderer->doRender(Array)
Drupal\Core\Render\Renderer->doRender(Array, )
Drupal\Core\Render\Renderer->render(Array, )
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1)
Stack\StackedHttpKernel->handle(Object, 1, 1)
Drupal\Core\DrupalKernel->handle(Object)
Comment #34
eclipsegc commentedThe list handler may need overriding for creating the proper edit button.
Eclipse
Comment #35
slashrsm commented@killua99: Could you provide clear steps for reproduction? I tried what you described in #33:
- installed drupal (8.1.x HEAD)
- installed entity_browser (8.x-1.x-dev)
- logged in
- navigated to /admin/config/content/entity_browser
Didn't get any error at all.
- clicked on "Add entity browser"
Didn't get any errors either.
If you have any existing entity_browser on your site please share their yaml files along with steps.
Comment #36
killua99 commentedSorry for the delay.
This was the old entity.browser yml files.
I had those two already installed. What I'm missing on those two?
Comment #37
slashrsm commented@killua99: Please check #2675390: Update config schema to allow translation. Let's continue this discussion there.