public class SectionManager

class.sectionmanager.php #13

The SectionManager is responsible for managing all Sections in a Symphony installation by exposing basic CRUD operations. Sections are stored in the database in tbl_sections.

Methods

static integer add(array $settings)

Takes an associative array of Section settings and creates a new entry in the tbl_sections table, returning the ID of the Section. The ID of the section is generated using auto_increment and returned as the Section ID.

Parameters
  • $settings arrayAn associative of settings for a section with the key being a column name from tbl_sections

Returns

The newly created Section's ID

static Section create()

Returns a new Section object, using the SectionManager as the Section's $parent.

static boolean createSectionAssociation(integer $parent_section_id, integer $child_field_id, integer $parent_field_id, boolean $show_association, mixed $interface, mixed $editor)

Create an association between a section and a field.

Parameters
  • $parent_section_id integerThe linked section id.

  • $child_field_id integerThe field ID of the field that is creating the association

  • $parent_field_id integer(optional) The field ID of the linked field in the linked section

  • $show_association boolean(optional) Whether of not the link should be shown on the entries table of the linked section. This defaults to true.

Returns

true if the association was successfully made, false otherwise.

static boolean delete(integer $section_id)

Deletes a Section by Section ID, removing all entries, fields, the Section and any Section Associations in that order

Parameters
  • $section_id integerThe ID of the Section to delete

Returns

Returns true when completed

static boolean edit(integer $section_id, array $settings)

Updates an existing Section given it's ID and an associative array of settings. The array does not have to contain all the settings for the Section as there is no deletion of settings prior to updating the Section

Parameters
  • $section_id integerThe ID of the Section to edit

  • $settings arrayAn associative of settings for a section with the key being a column name from tbl_sections

static Section|array fetch(integer|array $section_id, string $order, string $sortfield)

Returns a Section object by ID, or returns an array of Sections if the Section ID was omitted. If the Section ID is omitted, it is possible to sort the Sections by providing a sort order and sort field. By default, Sections will be order in ascending order by their name

Parameters
  • $section_id integer|arrayThe ID of the section to return, or an array of ID's. Defaults to null

  • $order stringIf $section_id is omitted, this is the sortorder of the returned objects. Defaults to ASC, other options id DESC

  • $sortfield stringThe name of the column in the tbl_sections table to sort on. Defaults to name

Returns

A Section object or an array of Section objects

static array fetchAssociatedSections(integer $section_id, 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
  • $section_id integerThe ID of the section

  • $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.

static array fetchChildAssociations(integer $section_id, 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
  • $section_id integerThe ID of the section

  • $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.

static integer fetchIDFromHandle(string $handle)

Return a Section ID by the handle

Parameters
  • $handle stringThe handle of the section

Returns

The Section ID

static integer fetchNextSortOrder()

Work out the next available sort order for a new section

Returns

Returns the next sort order

static array fetchParentAssociations(integer $section_id, 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
  • $section_id integerThe ID of the section

  • $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.

static boolean removeSectionAssociation(integer $field_id)

Permanently remove a section association for this field in the database.

Parameters
  • $field_id integerthe field ID of the linked section's linked field.

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