Documentation

CRM_Core_Form_Renderer extends HTML_QuickForm_Renderer_ArraySmarty
in package

Customize QF output to meet our specific requirements

Table of Contents

Properties

$_sizeMapper  : array<string|int, mixed>
The converter from array size to css class.
$_singleton  : object
We only need one instance of this object. So we use the singleton pattern and cache the instance in this variable

Methods

__construct()  : mixed
Constructor.
_elementToArray()  : array<string|int, mixed>
Creates an array representing an element containing.
_tplFetch()  : mixed
Process an template sourced in a string with Smarty
addOptionsEditLink()  : mixed
appendUnselectButton()  : mixed
preprocessContactReference()  : mixed
Pre-fill contact name for a custom field of type ContactReference
preProcessEntityRef()  : mixed
Convert IDs to values and format for display.
renderFrozenDatepicker()  : mixed
Render datepicker as text.
renderFrozenEntityRef()  : mixed
Render entity references as text.
renderFrozenSelect2()  : mixed
Render select2 as text.
singleton()  : mixed
Static instance provider.
updateAttributes()  : mixed
Update the attributes of this element and add a few CiviCRM based attributes so we can style this form element better
preProcessAutocomplete()  : mixed

Properties

$_sizeMapper

The converter from array size to css class.

public static array<string|int, mixed> $_sizeMapper = [2 => 'two', 4 => 'four', 6 => 'six', 8 => 'eight', 12 => 'twelve', 20 => 'medium', 30 => 'big', 45 => 'huge']

$_singleton

We only need one instance of this object. So we use the singleton pattern and cache the instance in this variable

private static object $_singleton = \NULL

Methods

__construct()

Constructor.

public __construct() : mixed

_elementToArray()

Creates an array representing an element containing.

public _elementToArray(HTML_QuickForm_element &$element, bool $required, string $error) : array<string|int, mixed>

the key for storing this. We allow the parent to do most of the work, but then we add some CiviCRM specific enhancements to make the html compliant with our css etc

Parameters
$element : HTML_QuickForm_element
$required : bool

Whether an element is required.

$error : string

Error associated with the element.

Return values
array<string|int, mixed>

_tplFetch()

Process an template sourced in a string with Smarty

public _tplFetch(string $tplSource) : mixed

This overrides the quick form function which has not been updated in a while.

The function is called when render the code to mark a field as 'required'

The notes on the quick form function seem to refer to older smarty - ie: Smarty has no core function to render a template given as a string. So we use the smarty eval plugin function to do this.

Parameters
$tplSource : string

The template source

public addOptionsEditLink(array<string|int, mixed> &$el, HTML_QuickForm_element $field) : mixed
Parameters
$el : array<string|int, mixed>
$field : HTML_QuickForm_element

appendUnselectButton()

public appendUnselectButton(array<string|int, mixed> &$el, HTML_QuickForm_element $field) : mixed
Parameters
$el : array<string|int, mixed>
$field : HTML_QuickForm_element

preprocessContactReference()

Pre-fill contact name for a custom field of type ContactReference

public static preprocessContactReference(HTML_QuickForm_element $field) : mixed

Todo: Migrate contact reference fields to use EntityRef

Parameters
$field : HTML_QuickForm_element

preProcessEntityRef()

Convert IDs to values and format for display.

public static preProcessEntityRef(HTML_QuickForm_element $field) : mixed
Parameters
$field : HTML_QuickForm_element

renderFrozenDatepicker()

Render datepicker as text.

public renderFrozenDatepicker(array<string|int, mixed> &$el, HTML_QuickForm_element $field) : mixed
Parameters
$el : array<string|int, mixed>
$field : HTML_QuickForm_element

renderFrozenEntityRef()

Render entity references as text.

public renderFrozenEntityRef(array<string|int, mixed> &$el, HTML_QuickForm_element $field) : mixed

If user has permission, format as link (for now limited to contacts).

Parameters
$el : array<string|int, mixed>
$field : HTML_QuickForm_element

renderFrozenSelect2()

Render select2 as text.

public renderFrozenSelect2(array<string|int, mixed> &$el, HTML_QuickForm_element $field) : mixed
Parameters
$el : array<string|int, mixed>
$field : HTML_QuickForm_element

singleton()

Static instance provider.

public static & singleton() : mixed

Method providing static instance of as in Singleton pattern.

updateAttributes()

Update the attributes of this element and add a few CiviCRM based attributes so we can style this form element better

public static updateAttributes(HTML_QuickForm_element &$element, bool $required, string $error) : mixed
Parameters
$element : HTML_QuickForm_element
$required : bool

Whether an element is required.

$error : string

Error associated with the element.

preProcessAutocomplete()

private static preProcessAutocomplete(HTML_QuickForm_element $field) : mixed
Parameters
$field : HTML_QuickForm_element

        
On this page

Search results