Datasource SectionDatasource

public class SectionDatasource extends Datasource

class.datasource.section.php #17

The SectionDatasource allows a user to retrieve entries from a given section on the Frontend. This datasource type exposes the filtering provided by the Fields in the given section to narrow the result set down. The resulting entries can be grouped, sorted and allows pagination. Results can be chained from other SectionDatasource's using output parameters.

Methods

boolean canProcessSystemParameters()

If this Datasource requires System Parameters to be output, this function will return true, otherwise false.

XMLElement execute(array $param_pool)

The meat of the Datasource, this function includes the datasource type's file that will preform the logic to return the data for this datasource It is passed the current parameters.

Parameters
  • $param_pool arrayThe current parameter pool that this Datasource can use when filtering and finding Entries or data.

Returns

The XMLElement to add into the XML for a page.

integer getSource()

Return's the Section ID that this datasource is using as it's source

XMLElement|boolean processEntry(Entry $entry)

Given an Entry object, this function will generate an XML representation of the Entry to be returned. It will also add any parameters selected by this datasource to the parameter pool.

Returns

Returns boolean when only parameters are to be returned.

void processFilters(string $where, string $joins, boolean $group)

This function iterates over dsParamFILTERS and builds the relevant $where and $joins parameters with SQL. This SQL is generated from Field->buildDSRetrievalSQL. A third parameter, $group is populated with boolean from Field->requiresSQLGrouping()

void processOutputParameters(Entry $entry, integer $field_id, array $data)

Given an Entry object, a $field_id and an array of $data, this function iterates over the dsParamPARAMOUTPUT and will call the field's (identified by $field_id) getParameterPoolValue function to add parameters to the $this->_param_pool.

XMLElement processRecordGroup(string $element, array $group)

Given a name for the group, and an associative array that contains three keys, attr, records and groups. Grouping of Entries is done by the grouping Field at a PHP level, not through the Database.

Parameters
  • $element stringThe name for the XML node for this group

  • $group arrayAn associative array of the group data, includes attr, records and groups keys.

void processSystemParameters(Entry $entry)

Given an Entry object, this function will iterate over the dsParamPARAMOUTPUT setting to see any of the Symphony system parameters need to be set. The current system parameters supported are system:id, system:author, system:creation-date and system:modification-date. If these parameters are found, the result is added to the $param_pool array using the key, ds-datasource-handle.parameter-name For the moment, this function also supports the pre Symphony 2.3 syntax, ds-datasource-handle which did not support multiple parameters.

Parameters
  • $entry EntryThe Entry object that contains the values that may need to be added into the parameter pool.

void setAssociatedEntryCounts(XMLElement $xEntry, Entry $entry)

An entry may be associated to other entries from various fields through the section associations. This function will set the number of related entries as attributes to the main <entry> element grouped by the related entry's section.

Parameters
  • $xEntry XMLElementThe XMLElement that the associated section counts will be set on

  • $entry EntryThe current entry object

void setSource(integer $source)

Set's the Section ID that this Datasource will use as it's source

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