\Settings\CustomFields
Templating
Global Functions
Website
\Components\Website\Designs \Components\Website\Media \Components\Website\Pages \Components\Website\Pages\Forms \Components\Website\Posts \Components\Website\Posts\Categories
Customers
\Components\Customers\Contacts \Components\Customers\Contacts\Relationships \Components\Customers\Contacts\Relationships\Types \Components\Customers\Groups
Marketing
\Components\Marketing\EmailMarketing \Components\Marketing\Events \Components\Marketing\Events\Attendees \Components\Marketing\Events\Categories \Components\Marketing\Events\Locations
Commerce
\Components\Commerce\Carts \Components\Commerce\Carts\Current \Components\Commerce\Configuration\PaymentMethods \Components\Commerce\Configuration\ShippingMethods \Components\Commerce\Discounts \Components\Commerce\Products \Components\Commerce\Products\Brands \Components\Commerce\Products\Categories \Components\Commerce\Products\Inventory \Components\Commerce\Sales \Components\Commerce\Sales\Items \Components\Commerce\Sales\Receipts \Components\Commerce\Sales\Receipts\Allocations
Settings
\Components\Settings\Administrators \Components\Settings\CustomFields
METHODS
\Components\Settings\Domains
Other Apps
\Components\Website\Comments \Components\Commerce\Affiliates \Components\Commerce\Affiliates\Administrators \Components\Commerce\Affiliates\Commissions \Components\Commerce\Affiliates\Payments \Components\Commerce\RecurringSales \Components\Commerce\RecurringSales\StoredCards
Framework
\Framework\Caching \Framework\Data\Util \Framework\DOM\CurrentContext \Framework\HTML\Converters \Framework\HTTP\Cookies \Framework\HTTP\Redirection \Framework\HTTP\Request \Framework\HTTP\Session \Framework\HTTP\UserAgent \Framework\I18N\CompanyTypes \Framework\I18N\Countries \Framework\I18N\Languages \Framework\Network\GeoIP

CustomFields

Methods

Invoke via \Components\Settings\CustomFields::method()
Click a method name to copy it.
bool delete($iCustomFieldId, $bDeleteMedia)
Deletes a record from the database
Parameters
$iCustomFieldId
int
A record's custom_field_id
$bDeleteMedia
mixed
Return
Returns true if record existed and was deleted, otherwise false
array get($iCustomFieldId)
Gets a record from the database
Parameters
$iCustomFieldId
int
A record's custom_field_id
Return
array getAll($arrQuery)
Return a set of records from the database
Parameters
$arrQuery
mixed
Return
Array of CustomFields
array|null getByComponentAndField($strComponent, $strField)
Returns a custom field from its component and field name
Parameters
$strComponent
mixed
$strField
mixed
Return
array|null
mixed getColumn($iCustomFieldId, $strColumn)
Gets a single field from a record
Parameters
$iCustomFieldId
int
A record's custom_field_id
$strColumn
mixed
Return
mixed
int getCount($arrFilter)
Returns the number of records in the database (matching the filter if specified)
Parameters
$arrFilter
mixed
Return
int
string|null getForm($strComponent, $strField)
Returns the form for a custom field
Parameters
$strComponent
mixed
$strField
mixed
Return
string|null
array|null getOptions($strComponent, $strField)
If the custom field contains options, return them as an array
Parameters
$strComponent
mixed
$strField
mixed
Return
array|null
string|int save($arrEntity)
Saves a record into the database
Parameters
$arrEntity
mixed
Return
string|int
void saveColumn($iCustomFieldId, $strColumn, $strValue)
Saves a specific column of a row into a database
Parameters
$iCustomFieldId
int
A record's custom_field_id
$strColumn
mixed
$strValue
mixed
array search($strSearch, $arrQuery)
Performs a search
Parameters
$strSearch
mixed
$arrQuery
mixed
Return
Array of CustomFields that match the search query.
string uniquifyDataColumns($strForm, $strSuffix)
Suffix all datacolumn's in the supplied form with the supplied string, allowing the custom field form to be unique when included in certain contexts such as
Automation conditions.
Parameters
$strForm
mixed
$strSuffix
mixed
Return
The uniquified form.
string uniquifyIDs($strForm, $strSuffix)
Suffix all id's in the supplied form with the supplied Id, allowing the custom field form to be unique when included in certain contexts such as
Automation conditions.
Parameters
$strForm
mixed
$strSuffix
mixed
Return
The uniquified form.

Database Fields

The following fields are used when retrieving and saving entities.
custom_field_id
int (11)
custom_field_component
string (255)
custom_field_table
string (255)
custom_field_is_editable
0 or 1
Default value: 1
field_id
string (255)
field_label
string (255)
field_description
string (255)
field_ui_type
string (255)
field_type
string (31)
field_default_value
string (31)
field_value_options
string (65535)
field_form
string (16777215)
field_is_mandatory
0 or 1
field_is_searchable
0 or 1
field_is_public
0 or 1
field_is_shown_in_lists
0 or 1
field_is_shown_in_checkout
0 or 1
field_is_shown_in_manual_sales
0 or 1
field_display
string (16777215)
field_order
int unsigned

Examples

Custom Fields Combobox

Fill the values of a Combobox from a Custom Field

HTML Code:

<forms:row label="Select Relevant Industry Category"> <forms:combobox id="contact_industry" datasource="\Components\Settings\CustomFields::getOptions('\Components\Customers\Contacts', 'contact_industry')" as="industry" datatitle="$industry" datavalue="$industry" /> </forms:row>

Display a Custom Field Value using Logic Parse

HTML Code:

<logic:parse text="[? \Components\Settings\CustomFields::getForm('\Components\Customers\Contacts', 'contact_industry') ?]" />