Field fieldSelect

public class fieldSelect extends Field

field.select.php #12

A simple Select field that essentially maps to HTML's <select/>. The options for this field can be static, or feed from another field.

Methods

void __construct(mixed $parent)

Construct a new instance of this field.

Parameters
  • $parent mixedThe class that created this Field object, usually the FieldManager, passed by reference.

boolean allowDatasourceOutputGrouping()

Test whether this field supports data-source output grouping. This default implementation prohibits grouping. Data-source grouping allows clients of this field to group the xml output according to this field. Subclasses should override this if grouping is supported.

Returns

true if this field does support data-source grouping, false otherwise.

boolean allowDatasourceParamOutput()

Test whether this field supports data-source parameter output. This default implementation prohibits parameter output. Data-source parameter output allows this field to be provided as a parameter to other data-sources or XSLT. Subclasses should override this if parameter output is supported.

Returns

true if this supports data-source parameter output, false otherwise.

void appendFormattedElement(XMLElement $wrapper, array $data, bool $encode, string $mode, integer $entry_id)

Append the formatted xml output of this field as utilized as a data source.

Parameters
  • $wrapper XMLElementthe xml element to append the xml representation of this to.

  • $data arraythe current set of values for this field. the values are structured as for displayPublishPanel.

  • $encode bool(optional) flag as to whether this should be html encoded prior to output. this defaults to false.

  • $mode stringA field can provide ways to output this field's data. For instance a mode could be 'items' or 'full' and then the function would display the data in a different way depending on what was selected in the datasource included elements.

  • $entry_id integer(optional) the identifier of this field entry instance. defaults to null.

boolean buildDSRetrievalSQL(array $data, string $joins, string $where, bool $andOperation)

Construct the SQL statement fragments to use to retrieve the data of this field when utilized as a data source.

Parameters
  • $data arraythe supplied form data to use to construct the query from

  • $joins stringthe join sql statement fragment to append the additional join sql to.

  • $where stringthe where condition sql statement fragment to which the additional where conditions will be appended.

  • $andOperation bool(optional) true if the values of the input data should be appended as part of the where condition. this defaults to false.

Returns

true if the construction of the sql was successful, false otherwise.

boolean canFilter()

Test whether this field can be filtered. This default implementation prohibits filtering. Filtering allows the xml output results to be limited according to an input parameter. Subclasses should override this if filtering is supported.

Returns

true if this can be filtered, false otherwise.

boolean canImport()

Test whether this field can be imported. This default implementation prohibits importing. Subclasses should override this is importing is supported.

Returns

true if this can be imported, false otherwise.

Deprecated

This function will be removed in the next major release. It is unused by Symphony.

boolean canPrePopulate()

Test whether this field can be prepopulated with data. This default implementation does not support pre-population and, thus, returns false.

Returns

true if this can be pre-populated, false otherwise.

boolean canToggle()

Test whether this field can be toggled using the With Selected menu on the Publish Index.

Returns

true if it can be toggled, false otherwise.

integer checkFields(array $errors, bool $checkForDuplicates)

Check the field's settings to ensure they are valid on the section editor

Parameters
  • $errors arraythe array to populate with the errors found.

  • $checkForDuplicates bool(optional) if set to true, duplicate Field name's in the same section will be flagged as errors. Defaults to true.

Returns

returns the status of the checking. if errors has been populated with any errors self::__ERROR__, self::__OK__ otherwise.

boolean commit()

Commit the settings of this field from the section editor to create an instance of this field in a section.

Returns

true if the commit was successful, false otherwise.

boolean createTable()

The default field table construction method. This constructs the bare minimum set of columns for a valid field table. Subclasses are expected to overload this method to create a table structure that contains additional columns to store the specific data created by the field.

void displayDatasourceFilterPanel(XMLElement $wrapper, mixed $data, mixed $errors, mixed $fieldnamePrefix, mixed $fieldnamePostfix, string $fieldNamePrefix, string $fieldNameSuffix)

Display the default data-source filter panel.

Parameters
  • $wrapper XMLElementthe input XMLElement to which the display of this will be appended.

  • $data mixed(optional) the input data. this defaults to null.

  • $errors mixed(optional) the input error collection. this defaults to null.

  • $fieldNamePrefix stringthe prefix to apply to the display of this.

  • $fieldNameSuffix stringthe suffix to apply to the display of this.

void displayPublishPanel(XMLElement $wrapper, array $data, mixed $flagWithError, string $fieldnamePrefix, mixed $fieldnamePostfix, integer $entry_id, string $fieldnameSuffix)

Display the publish panel for this field. The display panel is the interface shown to Authors that allow them to input data into this field for an Entry.

Parameters
  • $wrapper XMLElementthe xml element to append the html defined user interface to this field.

  • $data array(optional) any existing data that has been supplied for this field instance. this is encoded as an array of columns, each column maps to an array of row indexes to the contents of that column. this defaults to null.

  • $flagWithError mixed(optional) flag with error defaults to null.

  • $fieldnamePrefix string(optional) the string to be prepended to the display of the name of this field. this defaults to null.

  • $fieldnameSuffix string(optional) the string to be appended to the display of the name of this field. this defaults to null.

  • $entry_id integer(optional) the entry id of this field. this defaults to null.

void displaySettingsPanel(XMLElement $wrapper, mixed $errors)

Display the default settings panel, calls the buildSummaryBlock function after basic field settings are added to the wrapper.

Parameters
  • $wrapper XMLElementthe input XMLElement to which the display of this will be appended.

  • $errors mixed(optional) the input error collection. this defaults to null.

See Also
void|integer fetchAssociatedEntryCount(mixed $value)

Fetch the count of the associate entries for the input value. This default implementation does nothing.

Parameters
  • $value mixedthe value to find the associated entry count for.

Returns

this default implementation returns void. overriding implementations should return a number.

void|array fetchAssociatedEntryIDs(mixed $value)

Accessor to the ids associated with this field instance.

Parameters
  • $value mixedthe value to find the associated entry ids for.

Returns

this default implementation returns void. overriding implementations should return an array of the associated entry ids.

array fetchAssociatedEntrySearchValue(array $data, integer $field_id, integer $parent_entry_id)

Accessor to the associated entry search value for this field instance. This default implementation simply returns the input data argument.

Parameters
  • $data arraythe data from which to construct the associated search entry value.

  • $field_id integer(optional) an optional id of the associated field? this defaults to null.

  • $parent_entry_id integer(optional) an optional parent identifier of the associated field entry? this defaults to null.

Returns

the associated entry search value. this implementation returns the input data argument.

void findAndAddDynamicOptions(mixed $values)
void findDefaults(mixed $fields, array $settings)

Allows a field to set default settings.

Parameters
  • $settings arraythe array of settings to populate with their defaults.

XMLElement getExampleFormMarkup()

The default method for constructing the example form markup containing this field when utilized as part of an event. This displays in the event documentation and serves as a basic guide for how markup should be constructed on the Frontend to save this field

Returns

a label widget containing the formatted field element name of this.

string getParameterPoolValue(array $data)

Function to format this field if it chosen in a data-source to be output as a parameter in the XML

Parameters
  • $data arrayThe data for this field from it's tbl_entry_data_{id} table

Returns

The formatted value to be used as the parameter

array getToggleStates()

Accessor to the toggle states. This default implementation returns an empty array.

Returns

the array of toggle states.

void groupRecords(array $records)

Default implementation of record grouping. This default implementation will throw an Exception. Thus, clients must overload this method for grouping to be successful.

Parameters
  • $records arraythe records to group.

boolean isSortable()

Test whether this field can be sorted. This default implementation returns false.

Returns

true if this field is sortable, false otherwise.

string prepareTableValue(array $data, XMLElement $link)

Format this field value for display in the publish index tables. By default, Symphony will truncate the value to the configuration setting cell_truncation_length. This function will attempt to use PHP's mbstring functions if they are available.

Parameters
  • $data arrayan associative array of data for this string. At minimum this requires a key of 'value'.

  • $link XMLElement(optional) an xml link structure to append the content of this to provided it is not null. it defaults to null.

Returns

the formatted string summary of the values of this field instance.

array processRawFieldData(mixed $data, integer $status, bool $simulate, mixed $entry_id)

Process the raw field data.

Parameters
  • $data mixedpost data from the entry form

  • $status integerthe status code resultant from processing the data.

  • $simulate bool(optional) true if this will tell the CF's to simulate data creation, false otherwise. this defaults to false. this is important if clients will be deleting or adding data outside of the main entry object commit function.

  • $entry_id mixed(optional) the current entry. defaults to null.

Returns

the processed field data.

array toggleFieldData(array $data, string $newState)

Toggle the field data. This default implementation always returns the input data.

Parameters
  • $data arraythe data to toggle.

  • $newState stringthe new value to set

Returns

the toggled data.

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