There are a few tickets with the aim of allowing contextual changes to the views module view used within the entity browser. Each has merit and each is altering the view slightly differently. The aim of this issue is to see if there is any coordination between the issues that can be achieved and to make sure there isn't needless redundancy.
To do:
- #3041639: Add parent entity to #widget_context
- #2790951: Provide for contextual filter argument option on field widget - Adds option on field widget for arguments passed to the view using tokens
- #3038854: Provide hook to alter view executable before render in view widget - Provides an alter hook before the view is rendered with contextual information available. This could be used to set the arguments on the view, for example if you wanted to configure a view with current node id as a contextual filter, this is one way how you could add the view argument.
- #3032401: Provide docs on how to extend Entity Browser Display Plugins - Ticket asking for documentation
#2832240: Configure path arguments for View widget via UI- Adds option on the view widget plugin to specify url segments.- #2957134: Add tokens for embedded page path; allow them to be used in widget settings
- #3040938: Pass current selection in field_widget to #widget_context
Fixed
- #3039038: Provide views filter that limits based based on allowed bundles - Provides a ContextualBundle view filter plugin that updates bundles in Entity Browser based on #widget_context. Borrows #widget_context code from 2865928.
- #2865928: Provide method for views widget to filter based on context - Provides a views default argument plugin (EntityBrowserWidgetContext) that works with #widget_context. Passed bundles to view in field_widget, entity_embed and inline_entity_form_context. This is awesome and should get merged as soon as possible.
Comments
Comment #2
oknateWhen I first started to look at these issues I wasn't aware of '#widget_context' on the entity browser element.
Check out #2761833: Widget context and validators not passed to Entity Browser element for more information on this feature.
Comment #3
oknateComment #4
oknateAfter testing again, I think 2832240 makes less sense than 2865928 and 3038854.
Url argument path parts are more fragile than getting target_bundle and parameter from original route. For example on node form, the path /node/add/article changes once the entity is saved. Also, with entity embed, the url path parts would need to be overridden to get the original pages path parts. This is why a hook or the contextual default value view plugin makes more sense.
Even though the module supports url path parts already, I don't think this is the most stable way to get contextual filter arguments to the view.
Comment #5
oknateComment #6
oknateComment #7
oknateComment #8
oknateComment #9
oknateComment #10
oknateComment #11
oknateComment #12
oknateComment #13
oknateAdded an updated patch to #3039038: Provide views filter that limits based based on allowed bundles that fixes exposed filters option.
Comment #14
oknateComment #15
oknateComment #16
oknateComment #17
oknateComment #18
oknate