Field fieldUpload

public class fieldUpload extends Field

field.upload.php #10

A simple Upload field that essentially maps to HTML's <input type='file '/>.

Methods

void __construct()

Construct a new instance of this field.

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

void appendFormattedElement()

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

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

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

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

  • $mode A 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 (optional) the identifier of this field entry instance. defaults to null.

boolean buildDSRetrivalSQL()

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

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

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

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

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

void buildSortingSQL()

Build the SQL command to append to the default query to enable sorting of this field. By default this will sort the results by the entry id in ascending order.

Parameters
  • $joins the join element of the query to append the custom join sql to.

  • $where the where condition of the query to append to the existing where clause.

  • $sort the existing sort component of the sql query to append the custom sort sql code to.

  • $order (optional) an optional sorting direction. this defaults to ascending. if this is declared either 'random' or 'rand' then a random sort is applied.

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.

integer checkFields()

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

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

  • $checkForDuplicates (optional) if set to true, duplicate field entries will be flagged as errors. this defaults to true.

Returns

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

number checkPostFieldData()

Check the field data that has been posted from a form. This will set the input message to the error message or to null if there is none. Any existing message value will be overwritten.

Parameters
  • $data the input data to check.

  • $message the place to set any generated error message. any previous value for this variable will be overwritten.

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

Returns

self::__MISSING_FIELDS__ if there are any missing required fields, 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.

void 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 displayPublishPanel()

Display the publish panel for this field. The display panel is the interface to create the data in instances of this field once added to a section.

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

  • $data (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 (optional) flag with error defaults to null.

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

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

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

void displaySettingsPanel()

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

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

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

See Also
boolean entryDataCleanup()

Remove the entry data of this field from the database.

Parameters
  • $entry_id the id of the entry to delete.

  • $data (optional) The entry data provided for fields to do additional cleanup This is an optional argument and defaults to null.

Returns

true if the cleanup was successful, false otherwise.

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.

static void getMetaInfo()
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()

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 an associative array of data for this string. At minimum this requires a key of 'value'.

  • $link (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()

Process the raw field data.

Parameters
  • $data post data from the entry form

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

  • $simulate (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 (optional) the current entry. defaults to null.

Returns

the processed field 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