Documentation

CRM_Contact_Form_Task_SMSTrait uses trait:short

This trait provides the common functionality for tasks that send sms.

Table of Contents

Properties

$entityLookupDefinitions  : array<string|int, mixed>
Array of defined entity identifiers.
$entityLookupValues  : array<string|int, mixed>
Array of defined entity values.
$phones  : array<string|int, mixed>
The phones to be messaged.

Methods

formRuleSms()  : bool|array<string|int, mixed>
Form rule.
isDefined()  : bool
Check if an entity can be looked up
listTokens()  : array<string|int, mixed>
List available tokens for this form.
lookup()  : mixed
Retrieve a field value for a defined entity
postProcess()  : void
Process the form after the input has been submitted and validated.
setDefaultValues()  : array<string|int, mixed>
Set the default form values.
bounceOnNoActiveProviders()  : void
define()  : void
Defines a record so its values can be retrieved using `$this->lookup()`
filterContactIDs()  : void
getDefinition()  : array{entityName: string, identifier: array}|null
Retrieve entity definition (entityName string, identifier [keys/values])
getSmsProviderParams()  : array<string|int, mixed>
Get SMS provider parameters.
getValueForContact()  : mixed|null
Get the specified value for the contact.
isInvalidRecipient()  : bool
sendSMS()  : array<string|int, mixed>
Send SMS.

Properties

$entityLookupDefinitions

Array of defined entity identifiers.

private array<string|int, mixed> $entityLookupDefinitions = []

$entityLookupValues

Array of defined entity values.

private array<string|int, mixed> $entityLookupValues = []

$phones

The phones to be messaged.

private array<string|int, mixed> $phones

Methods

formRuleSms()

Form rule.

public static formRuleSms(array<string|int, mixed> $fields) : bool|array<string|int, mixed>
Parameters
$fields : array<string|int, mixed>

The input form values.

Return values
bool|array<string|int, mixed>

true if no errors, else array of errors

isDefined()

Check if an entity can be looked up

public isDefined(string $nickname) : bool
Parameters
$nickname : string
Return values
bool

listTokens()

List available tokens for this form.

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

lookup()

Retrieve a field value for a defined entity

public lookup(string $nickname, string $fieldName) : mixed
Parameters
$nickname : string

Handle set by $this->define()

$fieldName : string
Tags
throws
CRM_Core_Exception

postProcess()

Process the form after the input has been submitted and validated.

public postProcess() : void
Tags
throws
CRM_Core_Exception

setDefaultValues()

Set the default form values.

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

the default array reference

bounceOnNoActiveProviders()

protected bounceOnNoActiveProviders() : void

define()

Defines a record so its values can be retrieved using `$this->lookup()`

protected define(string $apiEntityName, string $nickname, array<string|int, mixed> $identifier) : void
Parameters
$apiEntityName : string
$nickname : string

Handle to use to retrieve values with $this->lookup()

$identifier : array<string|int, mixed>

A unique key or combination of keys to uniquely identify the record (usually id) Most commonly looks like ['id' => 123]

filterContactIDs()

protected filterContactIDs() : void

getDefinition()

Retrieve entity definition (entityName string, identifier [keys/values])

protected getDefinition(string $nickname) : array{entityName: string, identifier: array}|null
Parameters
$nickname : string
Return values
array{entityName: string, identifier: array}|null

getSmsProviderParams()

Get SMS provider parameters.

protected getSmsProviderParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

getValueForContact()

Get the specified value for the contact.

protected getValueForContact(int $contactID, string $value) : mixed|null

Note do not rename to getContactValue() - that function is used on many forms and does not take $id as a parameter.

Parameters
$contactID : int
$value : string
Tags
throws
CRM_Core_Exception
Return values
mixed|null

isInvalidRecipient()

protected isInvalidRecipient(mixed $contactID) : bool
Parameters
$contactID : mixed
Return values
bool

sendSMS()

Send SMS.

protected sendSMS(array<string|int, mixed> $phones) : array<string|int, mixed>
Parameters
$phones : array<string|int, mixed>
Tags
@return

array(array $errors, int $numberSent)

throws
CRM_Core_Exception
Return values
array<string|int, mixed>

        
On this page

Search results