- Symphony 2.7.3
-
› assets
14 -
› boot
15 -
› core
24 -
› cryptography
4 -
› data-sources
6 -
› email-gateways
3 -
› events
3 -
› global
61 -
› interface
9 -
› toolkit
60 - Delegates101
- Deprecated28
Versions
- 2.7.9
- 2.7.8
- 2.7.7
- 2.7.6
- 2.7.5
- 2.7.3
- 2.7.2
- 2.7.10
- 2.7.1
- 2.7.0
- 2.6.9
- 2.6.8
- 2.6.7
- 2.6.6
- 2.6.5
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.11
- 2.6.10
- 2.6.1
- 2.6.0
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2
Options
public class FieldManager
class.fieldmanager.php #12The FieldManager
class is responsible for managing all fields types in Symphony.
Fields are stored on the file system either in the /fields
folder of TOOLKIT
or
in a fields
folder in an extension directory.
Methods
static string __getClassName(
$type)
Given a type, returns the full class name of a Field. Fields use a 'field' prefix
Parameters
static string|boolean __getClassPath(
$type)
Finds a Field by type by searching the TOOLKIT . /fields
folder and then
any fields folders in the installed extensions. The function returns
the path to the folder where the field class resides.
Parameters
static string __getDriverPath(
$type)
Given a field type, return the path to it's class
Parameters
See Also
static string __getHandleFromFilename(
$filename)
Given the filename of a Field, return it's handle. This will remove
the Symphony conventions of field.*.php
Parameters
static boolean about(
$name)
This function is not implemented by the FieldManager
class
static integer|boolean add(
$fields)
Given an associative array of fields, insert them into the database returning the resulting Field ID if successful, or false if there was an error. As fields are saved in order on a section, a query is made to determine the sort order of this field to be current sort order +1.
Parameters
Returns
Returns a Field ID of the created Field on success, false otherwise.
static Field create(
$type)
Creates an instance of a given class and returns it. Adds the instance
to the $_pool
array with the key being the handle.
Parameters
static boolean delete(
$id)
Given a Field ID, delete a Field from Symphony. This will remove the field from
the fields table, all of the data stored in this field's tbl_entries_data_$id
any
existing section associations. This function additionally call the Field's tearDown
method so that it can cleanup any additional settings or entry tables it may of created.
Parameters
static boolean edit(
$id, $fields)
Given a Field ID and associative array of fields, update an existing Field
row in the tbl_fields
table. Returns boolean for success/failure
Parameters
static array fetch(
$id, $section_id, $order, $sortfield, $type, $location, $where, $restrict)
The fetch method returns a instance of a Field from tbl_fields. The most common use of this function is to retrieve a Field by ID, but it can be used to retrieve Fields from a Section also. There are several parameters that can be used to fetch fields by their Type, Location, by a Field Constant or with a custom WHERE query.
Parameters
Returns
An array of Field objects. If no Field are found, null is returned.
static mixed fetchFieldIDFromElementName(
$element_name, $section_id)
Given an $element_name
and a $section_id
, return the Field ID. Symphony enforces
a uniqueness constraint on a section where every field must have a unique
label (and therefore handle) so whilst it is impossible to have two fields
from the same section, it would be possible to have two fields with the same
name from different sections. Passing the $section_id
lets you to specify
which section should be searched. If $element_name
is null, this function will
return all the Field ID's from the given $section_id
.
Parameters
static string fetchFieldTypeFromID(
$id)
Given a field ID, return the type of the field by querying tbl_fields
static array fetchFieldsSchema(
$section_id)
Given a $section_id
, this function returns an array of the installed
fields schema. This includes the id
, element_name
, type
and location
.
Returns
An associative array that contains four keys, id
, element_name
, type
and location
static string fetchHandleFromID(
$id)
Given a field ID, return the handle of the field by querying tbl_fields
static integer fetchNextSortOrder()
Work out the next available sort order for a new field
Returns
Returns the next sort order
static boolean isFieldUsed(
$field_type)
Return boolean if the given $field_type
is in use anywhere in the
current Symphony install.
static boolean isTextFormatterUsed(
$text_formatter_handle)
Check if a specific text formatter is used by a Field
Parameters
Returns
true if used, false if not
static array listAll()
Returns an array of all available field handles discovered in the
TOOLKIT . /fields
or EXTENSIONS . /extension_handle/fields
.
Returns
A single dimensional array of field handles.
static boolean saveSettings(
$field_id, $settings)
Save the settings for a Field given it's $field_id
and an associative
array of settings.
Parameters
Returns
true on success, false on failure