Inject arbitrary values in Pattern fields
Hi,
While working on an UI Patterns integration as a Field Formatter, I have created a new Source Plugin to extract data from field properties.
To make this work useful enough, we also need to be able to inject in the pattern some values set directly in the field formatter.
For example, the value set for the "icon attributes" destination in this mock-up:

This issue is distinct from https://github.com/nuvoleweb/ui_patterns/issues/44 because, while it would be useful to have settings in Pattern plugins, we need to be free to map data and settings from FieldFormatter plugins:
- From FieldFormatter field property to Pattern variable
- From FieldFormatter setting to Pattern variable
- From FieldFormatter field property to Pattern setting, even if this situation may be uncommon
- From FieldFormatter setting to Pattern setting
This mechanism would be useful for FieldGroupFormatters pluins too, and will unlock exciting potential with https://www.drupal.org/project/extra_field
Is it something already planned?
This is a feature I would be really interested as well. Not having the ability to do this is actually a fairly big barrier to adoption of UI Patterns for me and my team - since we have a need to do this pretty regularly.
This is really interesting, to do so we would need to have a field source plugin widget and process it at submission, it's quite a challenge but it should be doable in a non BC breaking fashion.
Another upvote for this feature. Would be nice to be able to add fields to patterns, So we could have select lists, color picker, or any other type of drupal field with drupal's built in validation for that field type. A few use cases are selecting from a few different classes that are a color, or a boolean that sets a "highlight" option.
Obviously this can be done with variants right now, but it balloons quite a lot when you have the combinatorics of multiple options on a card.
@pdureau would something like https://www.drupal.org/project/ui_patterns_settings help you with that?
In case it does feel free to close this issue. Thanks!
Thanks @ademarco . I will test this solution soon and close the issue if OK