Event SectionEvent

public abstract class SectionEvent extends Event

class.event.section.php #14

The SectionEvent class provides methods required to save data entered on the frontend to a corresponding Symphony section.


array $filter_errors

An associative array of errors from the filters that have run on this event.

array $filter_results

An associative array of results from the filters that have run on this event.


XMLElement __doit(array $fields, XMLElement $result, integer $position, integer $entry_id)

This function does the bulk of processing the Event, from running the delegates to validating the data and eventually saving the data into Symphony. The result of the Event is returned via the $result parameter.

  • $fields arrayAn array of $_POST data, to process and add/edit an entry.

  • $result XMLElementThe XMLElement contains the result of the Event, it is passed by reference.

  • $position integerWhen the Expect Multiple filter is added, this event should expect to deal with adding (or editing) multiple entries at once.

  • $entry_id integerIf this Event is editing an existing entry, that Entry ID will be passed to this function.


The result of the Event

static string __reduceType(mixed $a, array $b, array $a,)

Helper method to determine if a field is missing, or if the data provided was invalid. Used in conjunction with array_reduce.


'missing' or 'invalid'

static XMLElement appendErrors(XMLElement $result, array $fields, array $errors, object $post_values)

Appends errors generated from fields during the execution of an Event

static XMLElement buildFilterElement(string $name, string $status, XMLElement|string $message, array $attributes)

This method will construct XML that represents the result of an Event filter.

  • $name stringThe name of the filter

  • $status stringThe status of the filter, either passed or failed.

  • $message XMLElement|stringOptionally, an XMLElement or string to be appended to this <filter> element. XMLElement allows for more complex return types.

  • $attributes arrayAn associative array of additional attributes to add to this <filter> element

static XMLElement createError(Field $field, string $type, string $message)

Given a Field instance, the type of error, and the message, this function creates an XMLElement node so that it can be added to the ?debug for the Event

  • $type stringAt the moment 'missing' or 'invalid' accepted

XMLElement|void execute()

This function will process the core Filters, Admin Only and Expect Multiple, before invoking the __doit function, which actually processes the Event. Once the Event has executed, this function will determine if the user should be redirected to a URL, or to just return the XML.


If $_REQUEST{'redirect'] is set, and the Event executed successfully, the user will be redirected to the given location. If $_REQUEST['redirect'] is not set, or the Event encountered errors, an XMLElement of the Event result will be returned.

XMLElement processSendMailFilter(XMLElement $result, array $send_email, array $fields, Section $section, Entry $entry)

This function handles the Send Mail filter which will send an email to each specified recipient informing them that an Entry has been created.

  • $result XMLElementThe XMLElement of the XML that is going to be returned as part of this event to the page.

  • $send_email arrayAssociative array of send-mail parameters.* Associative array of send-mail parameters.

  • $fields arrayArray of post data to extract the values from

  • $section SectionThis current Entry that has just been updated or created


The modified $result with the results of the filter.

static string|array replaceFieldToken(string $needle, array $haystack, string $default, boolean $discard_field_name, boolean $collapse)

This function searches the $haystack for the given $needle, where the needle is a string representation of where the desired value exists in the $haystack array. For example fields[name] would look in the $haystack for the key of fields that has the key name and return the value.

  • $needle stringThe needle, ie. fields[name].

  • $haystack arrayAssociative array to find the needle, ie. array('fields' => array( 'name' => 'Bob', 'age' => '10' ))

  • $default stringIf the $needle is not found, return this value. Defaults to null.

  • $discard_field_name booleanWhen matches are found in the $haystack, they are added to results array. This parameter defines if this should be an associative array or just an array of the matches. Used in conjunction with $collapse

  • $collapse booleanIf multiple values are found, this will cause them to be reduced to single string with ' ' as the separator. 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