modules/DynamicFields/DynamicField.php
\DynamicField
- Children
- \StandardField
Properties
Methods
addField(
\unknown_type $name, \unknown_type $label
=
'', \unknown_type $type
=
'Text', \unknown_type $max_size
=
'255', \unknown_type $required_option
=
'optional', \unknown_type $default_value
=
'', \unknown_type $ext1
=
'', \unknown_type $ext2
=
'', \unknown_type $ext3
=
'', \unknown_type $audited
=
0, \unknown_type $mass_update
=
0, \unknown_type $ext4
=
'', \unknown_type $help
=
'', \unknown_type $duplicate_merge
=
0, \unknown_type $comment
=
''
)
:
boolean
DEPRECIATED: Use addFieldObject instead.
Adds a Custom Field using parameters
Name | Type | Description |
---|---|---|
$name | \unknown_type | |
$label | \unknown_type | |
$type | \unknown_type | |
$max_size | \unknown_type | |
$required_option | \unknown_type | |
$default_value | \unknown_type | |
$ext1 | \unknown_type | |
$ext2 | \unknown_type | |
$ext3 | \unknown_type | |
$audited | \unknown_type | |
$mass_update | \unknown_type | |
$ext4 | \unknown_type | |
$help | \unknown_type | |
$duplicate_merge | \unknown_type | |
$comment | \unknown_type |
Type | Description |
---|---|
boolean |
addFieldObject(
\Field $field
)
:
boolean
Adds a custom field using a field object
Name | Type | Description |
---|---|---|
$field | \Field | Object $field |
Type | Description |
---|---|
boolean |
addLabel(
string $displayLabel
)
:
string
Adds a label to the module's mod_strings for the current language Note that the system label name
Name | Type | Description |
---|---|---|
$displayLabel | string | The label value to be displayed |
Type | Description |
---|---|
string | The core of the system label name - returns currency_id5 for example, when the full label would then be LBL_CURRENCY_ID5 TODO: Only the core is returned for historical reasons - switch to return the real system label |
add_existing_custom_field(
$data, $execute
=
true
)
:
void
Name | Type | Description |
---|---|---|
$data | ||
$execute |
add_existing_custom_fields(
$execute
=
true
)
:
void
Updates the db schema and adds any custom fields we have used if the custom table was dropped
Name | Type | Description |
---|---|---|
$execute |
buildCache(
STRING $module
=
false, boolean $saveCache
=
true
)
:
\unknown
Builds the cache for custom fields based on the vardefs
Name | Type | Description |
---|---|---|
$module | STRING | |
$saveCache | boolean | saveCache Boolean value indicating whether or not to pass saveCache value to saveToVardef, defaults to true |
Type | Description |
---|---|
\unknown |
createCustomTable(
$execute
=
true
)
:
void
Creates the custom table with an id of id_c
Name | Type | Description |
---|---|---|
$execute |
deleteField(
$widget
)
:
void
Deletes the field from fields_meta_data and drops the database column then it rebuilds the cache Use the widgets get_db_modify_alter_table() method to get the table sql - some widgets do not need any custom table modifications
Name | Type | Description |
---|---|---|
$widget |
fill_relationships(
)
:
void
Fills in all the custom fields of type relate relationships for an object
getDBName(
STRING $name, BOOLEAN $_C
=
true
)
:
STRING
Returns a Database Safe Name
Name | Type | Description |
---|---|---|
$name | STRING | |
$_C | BOOLEAN | do we append _c to the name |
Type | Description |
---|---|
STRING |
getFieldWidget(
$module, $fieldName
)
:
void
Returns the widget for a custom field from the fields_meta_data table.
Name | Type | Description |
---|---|---|
$module | ||
$fieldName |
getJOIN(
\$expandedList $expandedList
=
false, $includeRelates
=
false, $where
=
false
)
:
array
returns either false or an array containing the select and join parameter for a query using custom fields
Name | Type | Description |
---|---|---|
$expandedList | \$expandedList | boolean If true, return a list of all fields with source=custom_fields in the select instead of the standard _cstm.* This is required for any downstream construction of a SQL statement where we need to manipulate the select list, for example, listviews with custom relate fields where the value comes from join rather than from the custom table |
$includeRelates | ||
$where |
Type | Description |
---|---|
array | select=>select columns, join=>prebuilt join statement |
getRelateJoin(
$field_def, $joinTableAlias
)
:
void
Name | Type | Description |
---|---|---|
$field_def | ||
$joinTableAlias |
isDefaultValue(
$property, $value, $baseField
)
:
void
Name | Type | Description |
---|---|---|
$property | ||
$value | ||
$baseField |
retrieve(
)
:
void
DEPRECATED loads fields into the bean This used to be called during the retrieve process now it is done through a join Restored from pre-r30895 to maintain support for custom code that may have called retrieve() directly
save(
boolean $isUpdate
)
:
void
Process the save action for sugar bean custom fields
Name | Type | Description |
---|---|---|
$isUpdate | boolean |
saveExtendedAttributes(
$field, $column_fields
)
:
void
Name | Type | Description |
---|---|---|
$field | ||
$column_fields |
saveToVardef(
string $module, array $result, boolean $saveCache
=
true
)
:
void
Updates the cached vardefs with the custom field information stored in result
Name | Type | Description |
---|---|---|
$module | string | |
$result | array | |
$saveCache | boolean | saveCache Boolean value indicating whether or not to call VardefManager::saveCache, defaults to true |
setLabel(
$language
=
'en_us', $key, $value
)
:
void
Name | Type | Description |
---|---|---|
$language | ||
$key | ||
$value |
setup(
\SUGARBEAN $bean
=
null
)
:
void
This will add the bean as a reference in this object as well as building the custom field cache if it has not been built LOADS THE BEAN IF THE BEAN IS NOT BEING PASSED ALONG IN SETUP IT SHOULD BE SET PRIOR TO SETUP
Name | Type | Description |
---|---|---|
$bean | \SUGARBEAN |