0

As the title suggests, i'm trying to output the contents of a default instructions field within a Matrix block. I'm sure it's doable but not sure where to start?

Thanks

Martin

Martin
  • 1,203
  • 8
  • 18

1 Answers1

2

I just searched this Stack Exchange and found an answer on how to get the field model from the templates: How can I output the Field Name in my template?

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

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

Unfortunatelly, however, this won't work with fields within a Martix field. The getFieldbyHandle method is written for use in specific parts of the CP, where Craft knows the context the field is used in.

There's a getFieldbyId method though, which could work for your use case. The field's ID is independent from the context (inside Matrix or not).

carlcs
  • 36,220
  • 5
  • 62
  • 139
  • Hi Carlcs, thanks for looking, I should have said i'd already tried the method you also found. I'll give the getFieldbyID a try. – Martin Jan 18 '16 at 09:20