FormTemplate
extends EntityBase
in package
Class FormTemplate
Tags
Table of Contents
Constants
- USER_PROFILE_REGEXP = '/\{(ACCESS_[A-Z_0-9]+)\}/'
Properties
- $blockPrefix : string
- $contactLib : ContactLib
- $fieldTemplates : array<string|int, mixed>
- $form : Form
- $hasFileField : bool
- $langId : int
- $localeCodes : array<string|int, mixed>
- List of locale codes ordered by translation fallback order per Cx instance
- $nestingCount : int
- Counts the nesting level of __call()
- $page : Page
- $stringRepresentationBlank : bool
- Whether blank string representations are valid
- $stringRepresentationFields : array<string|int, mixed>
- List of fields that should be available in the string representation
- $stringRepresentationFormat : string
- Sprintf format for the string representation
- $template : Sigma
- $theme : Theme
- $uploaderCode : string
- $validators : array<string|int, mixed>
- Initialize this array as follows: array( 'columName' => Zend_Validate )
- $virtual : bool
- Defines if an entity is virtual and therefore not persistable.
Methods
- __call() : mixed
- Route methods like getName(), getType(), getDirectory(), etc.
- __construct() : mixed
- Constructor
- __get() : mixed
- This is an ugly solution to allow $this->cx to be available in all entity classes Since the entity's constructor is not called when an entity is loaded from DB this cannot be assigned there.
- __toString() : string
- Returns this entity's identifying value
- getComponentController() : SystemComponent
- Returns the component controller for this component
- getHtml() : string
- Get the submission form Content
- getKeyAsString() : string
- Returns this entity's key
- getTemplate() : Sigma
- Get Template object
- getTranslatedFieldValue() : mixed
- Returns the value of a translatable field using fallback mechanisms
- hasFileField() : bool
- hasFileField
- hideForm() : mixed
- To hide the submission form
- hideFormText() : mixed
- To hide the block formText
- initializeValidators() : mixed
- Set $this->validators
- initTemplate() : mixed
- Initialize the submission form and form field templates
- isVirtual() : bool
- Returns the virtuality of the entity
- parseFormTemplate() : mixed
- Parse Submission form and its form field values
- setCaptcha() : mixed
- Set Captcha content
- setVirtual() : mixed
- Set the virtuality of the entity
- showFormText() : mixed
- To show the block formText
- validate() : mixed
- getFallbackLocaleCodes() : array<string|int, mixed>
- Returns a list of all locale codes ordered by fallback order
- getFormFieldContent() : string
- Get Form field Content by using template-block contact_form_field_<TYPE> or 'theme specific form field template' or 'default form field template'
- getProfileData() : array<string|int, mixed>
- Get Profile data
- getStringRepresentationBlank() : bool
- Whether blank string representations are valid
- getStringRepresentationFields() : array<string|int, mixed>
- Returns a list of fields available in the string representation
- getStringRepresentationFormat() : string
- Returns the sprintf() format for the string representation
- getTemplateContent() : string
- Get Form/Form Field template content
- initContactForm() : mixed
- Initialize the Contact Form
- initUploader() : string
- Initialize the Uploader
- parseFormField() : string
- Parse Form Field
- parseFormFieldSelectOptions() : mixed
- Parse FormField's value
- parseInputFieldValue() : mixed
- Parse Input Field's value
- setSpecialFieldValue() : mixed
- Set values for special field types if the user is authenticated and there is no value set through GET and POST
Constants
USER_PROFILE_REGEXP
public
string
USER_PROFILE_REGEXP
= '/\{(ACCESS_[A-Z_0-9]+)\}/'
Properties
$blockPrefix
protected
string
$blockPrefix
= 'contact_form_field_'
$contactLib
protected
ContactLib
$contactLib
$fieldTemplates
protected
array<string|int, mixed>
$fieldTemplates
= array()
$form
protected
Form
$form
$hasFileField
protected
bool
$hasFileField
= false
$langId
protected
int
$langId
$localeCodes
List of locale codes ordered by translation fallback order per Cx instance
protected
static array<string|int, mixed>
$localeCodes
= array()
Array in the form: array(<instanceId> => array(<localeCode>, ...))
Tags
$nestingCount
Counts the nesting level of __call()
protected
static int
$nestingCount
= 0
$page
protected
Page
$page
$stringRepresentationBlank
Whether blank string representations are valid
protected
bool
$stringRepresentationBlank
= false
Whether blank string representations are valid
Tags
$stringRepresentationFields
List of fields that should be available in the string representation
protected
array<string|int, mixed>
$stringRepresentationFields
= array()
List of field names
Tags
$stringRepresentationFormat
Sprintf format for the string representation
protected
string
$stringRepresentationFormat
= ''
Sprintf format string
Tags
$template
protected
Sigma
$template
$theme
protected
Theme
$theme
$uploaderCode
protected
string
$uploaderCode
= ''
$validators
Initialize this array as follows: array( 'columName' => Zend_Validate )
protected
array<string|int, mixed>
$validators
= array()
$virtual
Defines if an entity is virtual and therefore not persistable.
protected
bool
$virtual
= false
Defaults to FALSE - not virtual.
Methods
__call()
Route methods like getName(), getType(), getDirectory(), etc.
public
__call(string $methodName, array<string|int, mixed> $arguments) : mixed
Parameters
- $methodName : string
-
Name of method to call
- $arguments : array<string|int, mixed>
-
List of arguments for the method to call
Tags
Attributes
- #[ReturnTypeWillChange]
Return values
mixed —Return value of the method to call
__construct()
Constructor
public
__construct(Form $form[, Page $page = null ][, Theme $theme = null ]) : mixed
Parameters
__get()
This is an ugly solution to allow $this->cx to be available in all entity classes Since the entity's constructor is not called when an entity is loaded from DB this cannot be assigned there.
public
__get(mixed $name) : mixed
Parameters
- $name : mixed
Attributes
- #[ReturnTypeWillChange]
__toString()
Returns this entity's identifying value
public
__toString() : string
By default this returns the same as getKeyAsString(), but this method might get overridden by subclasses.
Return values
string —Identifying value for this entity
getComponentController()
Returns the component controller for this component
public
getComponentController() : SystemComponent
Return values
SystemComponentgetHtml()
Get the submission form Content
public
getHtml() : string
Return values
string —Form content
getKeyAsString()
Returns this entity's key
public
final getKeyAsString([string $separator = '/' ]) : string
If this entity has a composite key, the fields are separated by $separator.
Parameters
- $separator : string = '/'
-
(optional) Separator for composite key fields, default "/"
Return values
string —Entity key as string
getTemplate()
Get Template object
public
getTemplate() : Sigma
Return values
SigmagetTranslatedFieldValue()
Returns the value of a translatable field using fallback mechanisms
public
getTranslatedFieldValue(string $fieldName) : mixed
If the field is not translatable its value is returned anyway. Tries to return the value in the following locales (if non-empty):
- Current locale
- Default locale
- All other locales
Parameters
- $fieldName : string
-
Name of a translatable field
hasFileField()
hasFileField
public
hasFileField() : bool
Return values
boolhideForm()
To hide the submission form
public
hideForm() : mixed
hideFormText()
To hide the block formText
public
hideFormText() : mixed
initializeValidators()
Set $this->validators
public
initializeValidators() : mixed
Validators can be found in lib/FRAMEWORK/Validator.class.php These will be executed if validate() is called
initTemplate()
Initialize the submission form and form field templates
public
initTemplate() : mixed
isVirtual()
Returns the virtuality of the entity
public
isVirtual() : bool
Return values
bool —TRUE if the entity is virtual, otherwise FALSE
parseFormTemplate()
Parse Submission form and its form field values
public
parseFormTemplate() : mixed
setCaptcha()
Set Captcha content
public
setCaptcha(bool $useCaptcha) : mixed
Parameters
- $useCaptcha : bool
-
If it is true then captcha will be shown otherwise not
setVirtual()
Set the virtuality of the entity
public
setVirtual(bool $virtual) : mixed
Parameters
- $virtual : bool
-
TRUE to set the entity as virtual or otherwise to FALSE
showFormText()
To show the block formText
public
showFormText() : mixed
validate()
public
validate() : mixed
Tags
getFallbackLocaleCodes()
Returns a list of all locale codes ordered by fallback order
protected
getFallbackLocaleCodes() : array<string|int, mixed>
- First entry is the current locale
- Second entry is the default locale (if different from current, it's omitted otherwise)
- Then all other locales follow (in no particular order)
Tags
Return values
array<string|int, mixed> —List of locale codes
getFormFieldContent()
Get Form field Content by using template-block contact_form_field_<TYPE> or 'theme specific form field template' or 'default form field template'
protected
getFormFieldContent(string $fieldType, string $specialType) : string
Parameters
- $fieldType : string
-
Form Field type
- $specialType : string
-
Form Field special type
Return values
string —Content of formfield
getProfileData()
Get Profile data
protected
getProfileData() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of Profile data
getStringRepresentationBlank()
Whether blank string representations are valid
protected
getStringRepresentationBlank() : bool
Return values
bool —Whether blank string representations are valid
getStringRepresentationFields()
Returns a list of fields available in the string representation
protected
getStringRepresentationFields() : array<string|int, mixed>
Return values
array<string|int, mixed> —List of field names
getStringRepresentationFormat()
Returns the sprintf() format for the string representation
protected
getStringRepresentationFormat() : string
Return values
string —sprintf() format string
getTemplateContent()
Get Form/Form Field template content
protected
getTemplateContent(string $fileName) : string
Parameters
- $fileName : string
-
Name of the file
Return values
string —Template content
initContactForm()
Initialize the Contact Form
protected
initContactForm() : mixed
initUploader()
Initialize the Uploader
protected
initUploader(Sigma $template, int $fieldId, bool $parseLegacyPlaceholder, bool $restrictUpload2SingleFile, bool &$isEmpty) : string
Parameters
- $template : Sigma
-
Template object
- $fieldId : int
-
Field ID
- $parseLegacyPlaceholder : bool
-
If true form has direct {<ID>_VALUE} an {<ID>_LABEL} placeholders otherwise false
- $restrictUpload2SingleFile : bool
-
If true Uploader accept only SingleFile otherwise Uploader handle Multiple Files
- $isEmpty : bool
-
Is set to
false
if no file has been uploaded to the field yet.
Return values
string —Uploader code
parseFormField()
Parse Form Field
protected
parseFormField(Sigma $template, int $fieldId, array<string|int, mixed> $arrField, array<string|int, mixed> $profileData[, bool $return = false ][, bool &$isEmpty = null ]) : string
Parameters
- $template : Sigma
-
Template object
- $fieldId : int
-
FormField ID
- $arrField : array<string|int, mixed>
-
Array of FormField values
- $profileData : array<string|int, mixed>
-
Array of profile data
- $return : bool = false
-
If true return the template content otherwise not
- $isEmpty : bool = null
-
Is set to
false
if the rendered field does not contain any data or has not pre-selected any option.
Return values
string —Parsed content of Form field
parseFormFieldSelectOptions()
Parse FormField's value
protected
parseFormFieldSelectOptions(Sigma $template, int $fieldId, string $fieldType, array<string|int, mixed> $options, bool $parseLegacyPlaceholder, array<string|int, mixed> $profileData, mixed $fieldLabel[, string $fieldValue = '' ], bool &$isEmpty) : mixed
Parameters
- $template : Sigma
-
Template object
- $fieldId : int
-
Field ID
- $fieldType : string
-
Field type
- $options : array<string|int, mixed>
-
Field option values
- $parseLegacyPlaceholder : bool
-
If true form has direct {<ID>_VALUE} and {<ID>_LABEL} placeholders otherwise false
- $profileData : array<string|int, mixed>
-
Array of profile data
- $fieldLabel : mixed
- $fieldValue : string = ''
-
Field value
- $isEmpty : bool
-
Is set to
false
if the rendered field has not pre-selected any option.
parseInputFieldValue()
Parse Input Field's value
protected
parseInputFieldValue(Sigma $template, int $fieldId, string $fieldValue, bool $parseLegacyPlaceholder, mixed $fieldType, bool &$isEmpty) : mixed
Parameters
- $template : Sigma
-
Template object
- $fieldId : int
-
Form Field ID
- $fieldValue : string
-
Form Field value
- $parseLegacyPlaceholder : bool
-
If true form has direct {<ID>_VALUE} and {<ID>_LABEL} placeholders otherwise false
- $fieldType : mixed
- $isEmpty : bool
-
Is set to
false
if the rendered field does not contain any data.
setSpecialFieldValue()
Set values for special field types if the user is authenticated and there is no value set through GET and POST
protected
setSpecialFieldValue(array<string|int, mixed> &$arrField, int $fieldId) : mixed
Parameters
- $arrField : array<string|int, mixed>
-
Array of field values
- $fieldId : int
-
Field ID