CRM_Core_Form_Task_PDFLetterCommon
in package
This is the base class for common PDF/Doc Merge functionality.
Most CRM_*_Form_Task_PDFLetterCommon classes extend the Contact version but the assumptions there are not always appropriate for other classes resulting in code duplication and unexpected dependencies. The intention is that common functionality can be moved here and the other classes cleaned up. Keep old-style token handling out of this class.
Table of Contents
Methods
- buildQuickForm() : mixed
- Build the form object.
- formatMessage() : mixed
- formRule() : bool
- Form rule.
- listTokens() : array<string|int, mixed>
- List the available tokens
- preProcess() : mixed
- processTemplate() : string
- Handle the template processing part of the form
- renderFromRows() : void
- Render html from rows
- setDefaultValues() : mixed
- Set default values.
- outputFromHtml() : mixed
- Output the pdf or word document from the generated html.
Methods
buildQuickForm()
Build the form object.
public
static buildQuickForm(mixed &$form) : mixed
Parameters
- $form : mixed
Tags
formatMessage()
public
static formatMessage(string &$message) : mixed
Parameters
- $message : string
formRule()
Form rule.
public
static formRule(array<string|int, mixed> $fields, array<string|int, mixed> $files, self $self) : bool
Parameters
- $fields : array<string|int, mixed>
-
The input form values.
- $files : array<string|int, mixed>
- $self : self
-
Additional values form 'this'.
Return values
bool —TRUE if no errors, else array of errors.
listTokens()
List the available tokens
public
static listTokens() : array<string|int, mixed>
Return values
array<string|int, mixed> —of token name => label
preProcess()
public
static preProcess(mixed &$form) : mixed
Parameters
- $form : mixed
processTemplate()
Handle the template processing part of the form
public
static processTemplate(array<string|int, mixed> &$formValues) : string
Parameters
- $formValues : array<string|int, mixed>
Tags
Return values
string —$html_message
renderFromRows()
Render html from rows
public
static renderFromRows(mixed $rows, string $msgPart, array<string|int, mixed> $formValues) : void
Parameters
- $rows : mixed
- $msgPart : string
-
The name registered with the TokenProcessor
- $formValues : array<string|int, mixed>
-
The values submitted through the form
setDefaultValues()
Set default values.
public
static setDefaultValues() : mixed
outputFromHtml()
Output the pdf or word document from the generated html.
protected
static outputFromHtml(array<string|int, mixed> $formValues, array<string|int, mixed> $html) : mixed
Parameters
- $formValues : array<string|int, mixed>
- $html : array<string|int, mixed>