Documentation

CRMTraits_Custom_CustomDataTrait

Trait Custom Data trait.

Trait for setting up custom data in tests.

Table of Contents

Methods

createCustomFieldsOfAllTypes()  : array<string|int, mixed>
createCustomGroup()  : int
Create a custom group.
createCustomGroupWithFieldOfType()  : void
Create a custom group with a single field.
createCustomGroupWithFieldsOfAllTypes()  : void
Create a custom group with fields of multiple types.
getCustomGroupTable()  : string
Get the table_name for the specified custom group.
getFieldsValuesByType()  : array<string|int, mixed>
Get default field values for the type of field.
addOptionToCustomField()  : int
Add another option to the custom field.
createAutoCompleteCustomField()  : array<string|int, mixed>
Create custom select field.
createBooleanCustomField()  : array<string|int, mixed>
Create a custom text fields.
createContactReferenceCustomField()  : array<string|int, mixed>
Create a custom text fields.
createCountryCustomField()  : array<string|int, mixed>
Create a custom country fields.
createDateCustomField()  : array<string|int, mixed>
Create a custom field of type date.
createFileCustomField()  : array<string|int, mixed>
Create a custom text fields.
createIntCustomField()  : array<string|int, mixed>
Create a custom text fields.
createIntegerRadioCustomField()  : array<string|int, mixed>
Create a custom field of type radio with integer values.
createLinkCustomField()  : array<string|int, mixed>
Create a custom text fields.
createMoneyTextCustomField()  : array<string|int, mixed>
Create a custom field of type money.
createMultiCountryCustomField()  : array<string|int, mixed>
Create a custom multi select country fields.
createMultiStateCustomField()  : array<string|int, mixed>
Create a custom multi select state fields.
createSelectCustomField()  : array<string|int, mixed>
Create custom select field.
createStateCustomField()  : array<string|int, mixed>
Create a custom state fields.
createStringCheckboxCustomField()  : array<string|int, mixed>
Create a custom field of type radio with integer values.
createTextCustomField()  : array<string|int, mixed>
Create a custom text fields.
getAvailableFieldCombinations()  : array<string|int, mixed>
Get data available for custom fields.
getCustomFieldColumnName()  : string
Get the the column name for the identified custom field.
getCustomFieldID()  : string
Get the custom field name for the relevant key.
getCustomFieldName()  : string
Get the custom field name for the relevant key.
getEntity()  : string
Get the entity being acted on.
getOptionGroupID()  : string
Get the option group id of the created field.
getOptionGroupName()  : string
Get the option group id of the created field.

Methods

createCustomFieldsOfAllTypes()

public createCustomFieldsOfAllTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

createCustomGroup()

Create a custom group.

public createCustomGroup([array<string|int, mixed> $params = [] ]) : int
Parameters
$params : array<string|int, mixed> = []
Return values
int

createCustomGroupWithFieldOfType()

Create a custom group with a single field.

public createCustomGroupWithFieldOfType([array<string|int, mixed> $groupParams = [] ][, string $customFieldType = 'text' ][, string|null $identifier = NULL ][, array<string|int, mixed> $fieldParams = [] ]) : void
Parameters
$groupParams : array<string|int, mixed> = []

Params for the group to be created.

$customFieldType : string = 'text'
$identifier : string|null = NULL
$fieldParams : array<string|int, mixed> = []

createCustomGroupWithFieldsOfAllTypes()

Create a custom group with fields of multiple types.

public createCustomGroupWithFieldsOfAllTypes([array<string|int, mixed> $groupParams = [] ]) : void
Parameters
$groupParams : array<string|int, mixed> = []

getCustomGroupTable()

Get the table_name for the specified custom group.

public getCustomGroupTable([string $identifier = 'Custom Group' ]) : string
Parameters
$identifier : string = 'Custom Group'
Return values
string

getFieldsValuesByType()

Get default field values for the type of field.

public getFieldsValuesByType(string $dataType[, string $htmlType = 'default' ]) : array<string|int, mixed>
Parameters
$dataType : string
$htmlType : string = 'default'
Return values
array<string|int, mixed>

addOptionToCustomField()

Add another option to the custom field.

protected addOptionToCustomField(string $key, array<string|int, mixed> $values) : int
Parameters
$key : string
$values : array<string|int, mixed>
Tags
throws
CRM_Core_Exception
Return values
int

createAutoCompleteCustomField()

Create custom select field.

protected createAutoCompleteCustomField(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createBooleanCustomField()

Create a custom text fields.

protected createBooleanCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createContactReferenceCustomField()

Create a custom text fields.

protected createContactReferenceCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createCountryCustomField()

Create a custom country fields.

protected createCountryCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createDateCustomField()

Create a custom field of type date.

protected createDateCustomField(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

createFileCustomField()

Create a custom text fields.

protected createFileCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createIntCustomField()

Create a custom text fields.

protected createIntCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createIntegerRadioCustomField()

Create a custom field of type radio with integer values.

protected createIntegerRadioCustomField(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

createLinkCustomField()

Create a custom text fields.

protected createLinkCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createMoneyTextCustomField()

Create a custom field of type money.

protected createMoneyTextCustomField(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

createMultiCountryCustomField()

Create a custom multi select country fields.

protected createMultiCountryCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createMultiStateCustomField()

Create a custom multi select state fields.

protected createMultiStateCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createSelectCustomField()

Create custom select field.

protected createSelectCustomField(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createStateCustomField()

Create a custom state fields.

protected createStateCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createStringCheckboxCustomField()

Create a custom field of type radio with integer values.

protected createStringCheckboxCustomField(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

createTextCustomField()

Create a custom text fields.

protected createTextCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

getAvailableFieldCombinations()

Get data available for custom fields.

protected getAvailableFieldCombinations() : array<string|int, mixed>

The 'default' key holds general values. Where more than one html type is an option then the any values that differ to the defaults are keyed by html key.

The order below is consistent with the UI.

Return values
array<string|int, mixed>

getCustomFieldColumnName()

Get the the column name for the identified custom field.

protected getCustomFieldColumnName(string $key) : string
Parameters
$key : string

Identifier - generally keys map to data type - eg. 'text', 'int' etc.

Return values
string

getCustomFieldID()

Get the custom field name for the relevant key.

protected getCustomFieldID(string $key) : string

e.g returns 'custom_5' where 5 is the id of the field using the key.

Generally keys map to data types.

Parameters
$key : string
Return values
string

getCustomFieldName()

Get the custom field name for the relevant key.

protected getCustomFieldName([string $key = 'text' ][, int $version = 3 ]) : string

e.g returns 'custom_5' where 5 is the id of the field using the key.

Generally keys map to data types.

Parameters
$key : string = 'text'
$version : int = 3
Tags
noinspection

PhpDocMissingThrowsInspection

noinspection

PhpUnhandledExceptionInspection

Return values
string

getEntity()

Get the entity being acted on.

protected getEntity() : string
Return values
string

getOptionGroupID()

Get the option group id of the created field.

protected getOptionGroupID(string $key) : string
Parameters
$key : string
Return values
string

getOptionGroupName()

Get the option group id of the created field.

protected getOptionGroupName(string $key) : string
Parameters
$key : string
Return values
string

        
On this page

Search results