Expose field item to context providers

Created on 15 October 2018, over 5 years ago
Updated 22 June 2023, about 1 year ago

Problem/Motivation

It would be great if the field widget could expose information about the widget to be retrievable by other code. Specifically, I'm thinking about custom or other contrib code implementing \Drupal\Core\Plugin\Context\ContextProviderInterface, it would be nice to be able to know at that point (::getRuntimeContexts()) which field triggered the available contexts call.

More specifically, imagine you have view A with a contextual filter on taxonomy vocabulary V1, and view B with a contextual filter on taxonomy vocabulary V2. You will want to expose terms of both vocabularies so editors can choose a fixed filter when placing the block, but you don't want to expose V1 terms on the view that only accepts terms of V2. Letting the context provider know the field definition would be enough for that.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain marcoscano Barcelona, Spain

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Since there's no interdiff from #11 to #12 / #13 @marcoscano can you tell what's the status and needs to be done here to finish this?

    Which patch should be reviewed? Should we add tests?

  • πŸ‡ͺπŸ‡ΈSpain penyaskito Seville πŸ’ƒ, Spain πŸ‡ͺπŸ‡Έ, UTC+2 πŸ‡ͺπŸ‡Ί

    If it helps, I've been using #13 so far with the same functionalities than what @marcoscano was implementing, so I'd suggest we pick from there.

Production build 0.69.0 2024