Take the 2-minute tour ×
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It's 100% free, no registration required.

I've created a plain text-field and added this field into a section. I then created an entry and filled it with content.

I know I can output the content of the field in my template with {{ entry.field_handle }}, but is it also possible to display the field name? If so, how?

share|improve this question

1 Answer 1

up vote 10 down vote accepted

You can get any field with craft.fields, which returns a FieldModel:

{% set field = craft.fields.getFieldbyHandle('field_handle') %}
{{ field.name }}
{{ field.instructions }}

.

Note: There is no documentation on the FieldModel yet, but if you want to know more, take a look at craft/app/models/FieldModel.php.

This is a list of all attributes supported by the Model:

  • groupId
  • name
  • handle
  • context
  • instructions
  • required
  • translatable
share|improve this answer
    
I ended up finding this in the docs buildwithcraft.com/docs/templating/craft.fields With some tinkering I also found out that {{craft.fields.getFieldbyHandle('field_handle') }} will work. –  RhealPoirier Jun 25 at 21:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.