public class Section

class.section.php #14

The Section class represents a Symphony Section object. A section is a model of a data structure using one or more Fields. Sections are stored in the database and are used as repositories for Entry objects, which are a model for this data structure. This class contains functions for finding Fields within a Section and saving a Section's settings.

Methods

boolean commit()

Commit the settings of this section from the section editor to create an instance of this section in tbl_sections. This function loops of each of the fields in this section and calls their commit function.

Returns

true if the commit was successful, false otherwise.

See Also
array fetchAssociatedSections(boolean $respect_visibility)

Returns any section associations this section has with other sections linked using fields. Has an optional parameter, $respect_visibility that will only return associations that are deemed visible by a field that created the association. eg. An articles section may link to the authors section, but the field that links these sections has hidden this association so an Articles column will not appear on the Author's Publish Index

Parameters
  • $respect_visibility booleanWhether to return all the section associations regardless of if they are deemed visible or not. Defaults to false, which will return all associations.

Deprecated

This function will be removed in Symphony 3.0. Use SectionManager::fetchChildAssociations instead.

array fetchChildAssociations(boolean $respect_visibility)

Returns any section associations this section has with other sections linked using fields, and where this section is the parent in the association. Has an optional parameter, $respect_visibility that will only return associations that are deemed visible by a field that created the association. eg. An articles section may link to the authors section, but the field that links these sections has hidden this association so an Articles column will not appear on the Author's Publish Index

Parameters
  • $respect_visibility booleanWhether to return all the section associations regardless of if they are deemed visible or not. Defaults to false, which will return all associations.

array fetchFields(string $type, string $location)

Returns an array of all the fields in this section optionally filtered by the field type or it's location within the section.

Parameters
  • $type stringThe field type (it's handle as returned by $field->handle())

  • $location stringThe location of the fields in the entry creator, whether they are 'main' or 'sidebar'

array fetchFieldsSchema()

Returns the Schema of this section which includes all this sections fields and their settings.

array fetchFilterableFields(string $location)

Returns an array of all the fields that can be filtered.

Parameters
  • $location stringThe location of the fields in the entry creator, whether they are 'main' or 'sidebar'

array fetchParentAssociations(boolean $respect_visibility)

Returns any section associations this section has with other sections linked using fields, and where this section is the child in the association. Has an optional parameter, $respect_visibility that will only return associations that are deemed visible by a field that created the association. eg. An articles section may link to the authors section, but the field that links these sections has hidden this association so an Articles column will not appear on the Author's Publish Index

Parameters
  • $respect_visibility booleanWhether to return all the section associations regardless of if they are deemed visible or not. Defaults to false, which will return all associations.

array fetchToggleableFields(string $location)

Returns an array of all the fields that can be toggled. This function is used to help build the With Selected drop downs on the Publish Index pages

Parameters
  • $location stringThe location of the fields in the entry creator, whether they are 'main' or 'sidebar'

array fetchVisibleColumns()

Returns an array of all the fields in this section that are to be displayed on the entries table page ordered by the order in which they appear in the Section Editor interface

array|string get(null|string $setting)

An accessor function for this Section's settings. If the $setting param is omitted, an array of all settings will be returned. Otherwise it will return the data for the setting given.

Returns

If setting is provided, returns a string, if setting is omitted returns an associative array of this Section's settings

string getDefaultSortingField()

Returns the default field this Section will be sorted by. This is determined by the first visible field that is allowed to to be sorted (defined by the field's isSortable() function). If no fields exist or none of them are visible in the entries table, 'id' is returned instead.

Returns

Either the field ID or the string 'id'.

string getSortingField()

Returns the field this Section will be sorted by, or calls getDefaultSortingField() if the configuration file doesn't contain any settings for that Section.

Returns

Either the field ID or the string 'id'.

string getSortingOrder()

Returns the sort order for this Section. Defaults to 'asc'.

Returns

Either 'asc' or 'desc'.

void set(string $setting, string $value)

A setter function that will save a section's setting into the poorly named $this->_data variable

Parameters
  • $setting stringThe setting name

  • $value stringThe setting value

void setSortingField(string $sort, boolean $write)

Saves the new field this Section will be sorted by.

Parameters
  • $sort stringThe field ID or the string 'id'.

  • $write booleanIf false, the new settings won't be written on the configuration file. Defaults to true.

void setSortingOrder(string $order, boolean $write)

Saves the new sort order for this Section.

Parameters
  • $order stringEither 'asc' or 'desc'.

  • $write booleanIf false, the new settings won't be written on the configuration file. Defaults to true.

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