I’ve just checked the file that would parse this and there’s no field_label available (/system/ee/legacy/libraries/Fluid_field_parser.php).
If I were you I would use the current_field_name and make it human readable with PHP’s str_replace() - replacing underscores with spaces and then making the first letter a capital using ucfirst().
Something like:
<? echo ucfirst(str_replace(‘_’, ’ ‘, ‘{current_field_title}’)); ?>
Hope this helps.
@ianumeda, can you help us understand the use case here?
Typically when you’re creating the template code for a fluid field, it’s always going to be the same field. In that case, you can just hardcode the field name. I’m thinking this would only change if you feel that the field name might be changed on a regular basis. thanks.
Hello @seavers and @andy,
Thanks for your replies. Here’s the situation: I have a collection of Articles compiled by a Issue entry. The Issue has a fluid field with a series of relationship fields that define sections of each Issue.
What I want to do was output the Name the relationship field as a heading for the Article as a reference to the section where the article resides in the Issue. Since all I can access is the field’s short_name I’ve had to employ a solution like @severs suggested which was to modify the field’s short_name with str_replace(). This doesn’t seem like a very robust solution especially because I expect I’ll want to be able to change the Headings in the future without all the disruption caused by changing a field’s short_name. If the field’s Name was accessible to the template I would just have to update the field’s Name to update the heading.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.