Search

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).

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.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details