It would be usefull to show a (user defined) fields value on an entry when it's collapsed.

Indeed, it would be cool to be able to define an underscore template so that some logic can be embedded.
Folks, this sounds like a really useful feature.
Care to provide a prototype implementation, and/or a vision of how you'd expect it to be defined from the developer's perspective?
I created a prototype for this here: https://github.com/tschortsch/carbon-fields/commit/f0beb59bd5403374645c5becf17c4a08b7277d8b. Right now I just tested it with Fields of type Text.
It has to be checked / enhanced for all the other field types. I could do that but first I wanted to know if I go in the right direction?
Thanks for taking the initiative!
What do you think about the idea of using an underscore template? I was thinking on the case where there is a name and surname field and we want to show both of them on the header. Something like:
Field::make('complex', 'staff')->add_fields([
Field::make('text', 'name'),
Field::make('text', 'surname'),
])->set_header_template('{{ surname }}, {{ name }}'); // or set_title, set_header…
It would be nice also to support images and other data types… but I'm not sure how doable and desirable it is as a feature. I can imagine use cases where having the image in the header can be a nice touch, but if the JS API it's not developed I understand that it can be quite a work.
Just asking… tell me if I can help somehow. ^_^
@tschortsch: I believe forcing it wouldn't be a good idea.
@doup: I really like that suggestion. We should implement it :+1:
The feature has been implemented here: https://github.com/htmlburger/carbon-fields/pull/35.
Props @m1r0.
Documentation coming soon, as well.
@tschortsch, @doup, thanks for the great ideas, folks :+1:
Documentation of the new feature has been added: https://github.com/htmlburger/carbon-fields-docs/pull/6/commits/9c7e5251449dc98366a9c736b779d859bd665525
Wow, thanks! Looks really neat, I'll test it next week in a couple of projects. 👍 👍 👍
Most helpful comment
Thanks for taking the initiative!
What do you think about the idea of using an underscore template? I was thinking on the case where there is a
nameandsurnamefield and we want to show both of them on the header. Something like:It would be nice also to support images and other data types… but I'm not sure how doable and desirable it is as a feature. I can imagine use cases where having the image in the header can be a nice touch, but if the JS API it's not developed I understand that it can be quite a work.
Just asking… tell me if I can help somehow. ^_^