13

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?

Ben Parizek
  • 13,448
  • 1
  • 33
  • 98
RhealPoirier
  • 297
  • 1
  • 10

1 Answers1

15

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
Victor
  • 8,376
  • 1
  • 34
  • 61
  • 1
    I ended up finding this in the docs http://buildwithcraft.com/docs/templating/craft.fields With some tinkering I also found out that {{craft.fields.getFieldbyHandle('field_handle') }} will work. – RhealPoirier Jun 25 '14 at 21:50