Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Dear Couchmembers,

I'm wondering if anyone knows how to dump all the custom field data of a given template.

I'm not looking to retrieve values (such as <cms:get_field 'my_field' masterpage='my-template.php' />). Rather, I'm hoping to list all the editable field names and all the data related to them, such as their editable type, what opt_values may be defined on them, etc.

Something like:

Code: Select all
<cms:pages masterapge='my-template.php'>
  <cms:dump_custom_field_data />
</cms:pages>

// Output

# custom field data:
  *my_text*:
    - field_name: my_text
    - field_type: text
    - field_value: My text value here
  *my_dropdown*:
    - field_name: my_dropdown
    - field_type: dropdown
    - field_value: option 2
    - field_opt_values: option 1 | option 2 | option 3
    - field_opt_selected: option 1

Yep, that is possible - tag 'cms:db_fields'

Try the following -
Code: Select all
<cms:db_fields masterpage=''>
    <cms:dump />
</cms:db_fields>
Oh, perfect! I looked everywhere in couch/tags.php and didn't think to check data-bound-form addon! Will keep Simon's CouchDocs bookmarked.

Thank you Anton (and Simon) :)
3 posts Page 1 of 1
cron