trait CRM_Core_Form_EntityFormTrait

Properties

protected int $_entitySubTypeId The entity subtype ID (eg. for Relationship / Activity)

Methods

array
getEntityFields()

Get entity fields for the entity to be added to the form.

getDefaultContext()

Explicitly declare the form context.

string
getDeleteMessage()

Get entity fields for the entity to be added to the form.

setDeleteMessage()

Set the delete message.

setEntityFields()

Set entity fields to be assigned to the form.

int|null
getEntityId()

Get the entity id being edited.

bool
isSuppressCustomData()

Should custom data be suppressed on this form.

int|null
getEntitySubTypeId($subTypeId)

Get the entity subtype ID being edited

addCustomDataToForm()

If the custom data is in the submitted data (eg. added via ajax loaded form) add to form.

buildQuickEntityForm()

Build the form object.

buildDeleteForm()

Build the form for any deletion.

addFormButtons()

Add relevant buttons to the form.

getEntityDefaults()

Get the defaults for the entity.

string|int|bool
getValidationTypeForField(string $fieldName)

Get the validation rule to apply to a function.

setTranslatedFields()

Set translated fields.

addEntityFieldsToTemplate()

Add defined entity field to template.

bool
isDeleteContext()

Is the form being used in the context of a deletion.

bool
isViewContext()

Is the form being used in the context of a view.

setEntityFieldsMetadata()

No description

Details

at line 47
array getEntityFields()

Get entity fields for the entity to be added to the form.

Return Value

array

at line 54
getDefaultContext()

Explicitly declare the form context.

at line 63
string getDeleteMessage()

Get entity fields for the entity to be added to the form.

Return Value

string

at line 72
setDeleteMessage()

Set the delete message.

We do this from the constructor in order to do a translation.

at line 78
protected setEntityFields()

Set entity fields to be assigned to the form.

at line 86
int|null getEntityId()

Get the entity id being edited.

Return Value

int|null

at line 95
protected bool isSuppressCustomData()

Should custom data be suppressed on this form.

Return Value

bool

at line 106
int|null getEntitySubTypeId($subTypeId)

Get the entity subtype ID being edited

Parameters

$subTypeId

Return Value

int|null

at line 116
addCustomDataToForm()

If the custom data is in the submitted data (eg. added via ajax loaded form) add to form.

at line 129
buildQuickEntityForm()

Build the form object.

at line 151
protected buildDeleteForm()

Build the form for any deletion.

at line 159
protected addFormButtons()

Add relevant buttons to the form.

at line 187
protected getEntityDefaults()

Get the defaults for the entity.

at line 228
protected string|int|bool getValidationTypeForField(string $fieldName)

Get the validation rule to apply to a function.

Alphanumeric is designed to always be safe & for now we just return that but in future we can use tighter rules for types like int, bool etc.

Parameters

string $fieldName

Return Value

string|int|bool

at line 245
protected setTranslatedFields()

Set translated fields.

This function is called from the class constructor, allowing us to set fields on the class that can't be set as properties due to need for translation or other non-input specific handling.

at line 265
protected addEntityFieldsToTemplate()

Add defined entity field to template.

at line 283
protected bool isDeleteContext()

Is the form being used in the context of a deletion.

(For some reason rather than having separate forms Civi overloads one form).

Return Value

bool

at line 292
protected bool isViewContext()

Is the form being used in the context of a view.

Return Value

bool

at line 296
protected setEntityFieldsMetadata()