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

slashrsm’s picture

Issue tags: -sprint +D8Media
jelle_s’s picture

This 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.

slashrsm’s picture

Check 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.

slashrsm’s picture

Priority: Major » Critical
ericduran’s picture

One 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 :)

slashrsm’s picture

Here we go: https://github.com/drupal-media/d8-guide/pull/7

Any feedback welcome.

ericduran’s picture

Super useful. Thanks.

slashrsm’s picture

Status: Active » Needs work
Issue tags: -Novice +Zurich media sprint 2015

I 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.

CTaPByK’s picture

Assigned: Unassigned » CTaPByK

Ok i do not hesitate :) and i start working on this.

CTaPByK’s picture

Status: Needs work » Needs review

I 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

slashrsm’s picture

Status: Needs review » Needs work

I tested it. Remove works. Weights are saved. We still need to save other stuff and I left a comment about entity list.

CTaPByK’s picture

Status: Needs work » Needs review

I make another commit and i think saving widgets configuration now is ok.
https://github.com/drupal-media/entity_browser/pull/137.

slashrsm’s picture

StatusFileSize
new51.38 KB

I 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.

Status: Needs review » Needs work

The last submitted patch, 13: 2512702_13.patch, failed testing.

slashrsm’s picture

Status: Needs work » Needs review
StatusFileSize
new51.45 KB

I committed test_dependencies and rebased.

Not sure how long it takes for D.o to update test dependencies registry.

Status: Needs review » Needs work

The last submitted patch, 15: 2512702_15.patch, failed testing.

The last submitted patch, 15: 2512702_15.patch, failed testing.

The last submitted patch, 15: 2512702_15.patch, failed testing.

The last submitted patch, 15: 2512702_15.patch, failed testing.

The last submitted patch, 15: 2512702_15.patch, failed testing.

eclipsegc’s picture

+++ b/src/DisplayBase.php
@@ -78,7 +80,10 @@ abstract class DisplayBase extends PluginBase implements DisplayInterface, Conta
+    return array_diff_key(
+      $this->configuration,
+      ['entity_browser_id' => 0]
+    );

This 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

luksak’s picture

I 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?

slashrsm’s picture

Every 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?

luksak’s picture

StatusFileSize
new51.44 KB

Makes sense. The patch doesn't apply anymore. Here is a re-roll.

luksak’s picture

Status: Needs work » Needs review
slashrsm’s picture

StatusFileSize
new54.48 KB
new3.44 KB

This converts ctools from hard to a soft dependency. We should be good to go.

Status: Needs review » Needs work

The last submitted patch, 26: 2512702_26.patch, failed testing.

slashrsm’s picture

Status: Needs work » Needs review
StatusFileSize
new55.7 KB
new1.61 KB

Readme update + attempt to fix tests.

Status: Needs review » Needs work

The last submitted patch, 28: 2512702_28.patch, failed testing.

slashrsm’s picture

Status: Needs work » Needs review
StatusFileSize
new56.38 KB
new691 bytes

  • slashrsm committed fbaab63 on 8.x-1.x
    Issue #2512702 by slashrsm, Lukas von Blarer, CTaPByK, EclipseGc:...
slashrsm’s picture

Status: Needs review » Fixed

Committed. Finally! Super exciting.

Thanks everyone!

killua99’s picture

After 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)

eclipsegc’s picture

The list handler may need overriding for creating the proper edit button.

Eclipse

slashrsm’s picture

@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.

killua99’s picture

Sorry for the delay.

This was the old entity.browser yml files.

I had those two already installed. What I'm missing on those two?

slashrsm’s picture

@killua99: Please check #2675390: Update config schema to allow translation. Let's continue this discussion there.

Status: Fixed » Closed (fixed)

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