Get a section´s field names from a Section object?
This is an open discussion with 3 replies, filed under General.
Search
When you have the section’s id
you can do something like this
// get fields from section $fieldManager = new FieldManager(Symphony::Engine()); $fields = $fieldManager->fetch(NULL, $section_id);
to get an array of field objects.
If you’ve already got a Section object,
$section->fetchFields()
works as well, which returns an associative array of field objects. You can loop over the array to get the Field names.
Thanks alot! For some reason I didn´t think fetchFields()
was right first time I tried it, but turns out I was just using it wrong.
Create an account or sign in to comment.
I was wondering how you could get a section´s field names from the Section object?
The closest I´ve come so far is the handle for the fields using the Section object´s
fetchFieldsSchema()
-method.For example, if an “Article”-section has the fields: Title, Body, Intro. I would like the names of those fields, not just the handle.
Thank you in advance!
By the way, I´m using version 2.0.8RC3 (forum ensemble).