Documentation

CRM_Contact_Form_Task_PDFTrait

This class provides the common functionality for tasks that send emails.

Table of Contents

Methods

addPDFElementsToForm()  : void
Build the form object.
buildQuickForm()  : void
Build the form object.
formatMessage()  : mixed
formRulePDF()  : bool|array<string|int, mixed>
Form rule.
getFileName()  : string
Returns the filename for the pdf by striping off unwanted characters and limits the length to 200 characters.
postProcess()  : void
Process the form after the input has been submitted and validated.
preProcessPDF()  : void
Prepare form.
processMessageTemplate()  : array<string|int, mixed>
Part of the post process which prepare and extract information from the template.
processTemplate()  : string
Handle the template processing part of the form
setDefaultValues()  : array<string|int, mixed>
Set defaults for the pdf.
createActivities()  : array<string|int, mixed>
getButtons()  : array<string|int, mixed>
Get the buttons to display.
getFieldsToExcludeFromPurification()  : array<string|int, mixed>
getFromEmails()  : array<string|int, mixed>
Get an array of email IDS from which the back-office user may select the from field.
getMainSubmitButtonName()  : string
Get the name for the main submit button.
getMimeType()  : string
Convert from a vague-type/file-extension to mime-type.
getPDFDefaultValues()  : array<string|int, mixed>
Set default values.
isLiveMode()  : bool
Is the form in live mode (as opposed to being run as a preview).

Methods

formatMessage()

public formatMessage(mixed &$message) : mixed
Parameters
$message : mixed

formRulePDF()

Form rule.

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

The input form values.

$files : array<string|int, mixed>
Return values
bool|array<string|int, mixed> —

TRUE if no errors, else array of errors.

getFileName()

Returns the filename for the pdf by striping off unwanted characters and limits the length to 200 characters.

public getFileName() : string
Return values
string —

The name of the file.

postProcess()

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

public postProcess() : void
Tags
throws
CRM_Core_Exception

preProcessPDF()

Prepare form.

public preProcessPDF() : void

processMessageTemplate()

Part of the post process which prepare and extract information from the template.

public processMessageTemplate(array<string|int, mixed> $formValues) : array<string|int, mixed>
Parameters
$formValues : array<string|int, mixed>
Return values
array<string|int, mixed> —

[$categories, $html_message, $messageToken, $returnProperties]

processTemplate()

Handle the template processing part of the form

public processTemplate(array<string|int, mixed> &$formValues) : string
Parameters
$formValues : array<string|int, mixed>
Tags
throws
CRM_Core_Exception
throws
UnauthorizedException
Return values
string —

$html_message

setDefaultValues()

Set defaults for the pdf.

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

createActivities()

protected createActivities(string $html_message, array<string|int, mixed> $contactIds, string $subject, int $campaign_id[, array<string|int, mixed> $perContactHtml = [] ]) : array<string|int, mixed>
Parameters
$html_message : string
$contactIds : array<string|int, mixed>
$subject : string
$campaign_id : int
$perContactHtml : array<string|int, mixed> = []
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed> —

List of activity IDs. There may be 1 or more, depending on the system-settings and use-case.

getButtons()

Get the buttons to display.

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

getFieldsToExcludeFromPurification()

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

getFromEmails()

Get an array of email IDS from which the back-office user may select the from field.

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

getMainSubmitButtonName()

Get the name for the main submit button.

protected getMainSubmitButtonName() : string
Return values
string

getMimeType()

Convert from a vague-type/file-extension to mime-type.

protected getMimeType(string $type) : string
Parameters
$type : string
Tags
throws
CRM_Core_Exception
Return values
string

getPDFDefaultValues()

Set default values.

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

isLiveMode()

Is the form in live mode (as opposed to being run as a preview).

protected isLiveMode() : bool

Returns true if the user has clicked the Download Document button on a Print/Merge Document (PDF Letter) search task form, or false if the Preview button was clicked.

Return values
bool —

TRUE if the Download Document button was clicked (also defaults to TRUE if the form controller does not exist), else FALSE


        
On this page

Search results