Option label support in set_header_template()
I have a select field coded as followed:
->set_layout('tabbed-vertical')
->add_fields(array(
Field::make('select','project')->add_options(array(
25 => 'Project Name',
37 => 'Second Project Name'
))
))
->set_header_template('<%- project %>')
Currently this returns the project id as the tab-label. But this isn't very useful. Is it possible to set the project name (array value) as header for my tabs?
Using 2.0
Currently, this is not supported, however you can make use of Lodash template conditionals for a dirty and hacky solution by generating the template conditionals based on the options you pass to the field.
Thank you Atanas, I'll give it a try
Would love if this feature was available. The hacky solution doesn't work for me because the options array is a dynamically created list of posts that meet certain conditions.
https://github.com/htmlburger/carbon-fields/issues/793#issuecomment-574587611 has a nice workaround