class FormComment extends FormTextarea

Class FormComment

Constants

deprecated WYSIWYGToolbar_Basic

WYSIWYGToolbar_Auto

Primary Toolbars used in XELOS

WYSIWYGToolbar_NoImgNoHTML

WYSIWYGToolbar_NoHTML

WYSIWYGToolbar_Full

CODEEditor_Language_JAVASCRIPT

Commonly used CodeMirror modes, refer to JSLIB directory for more modes

CODEEditor_Language_LESS

CODEEditor_Language_CSS

CODEEditor_Language_HTML

CODEEditor_Language_PHP

CODEEditor_Language_PHPONLY

CODEEditor_Language_MARKDOWN

Properties

protected array $config from  FormBase
bool $save_requires_edit_var from  FormBase
Form $form from  FormComponent
protected $field_disable_save

Set to false if this field is not "saveable", e.g. static test

from  FormBase
$REQUEST_VARS from  FormComponent
$name from  FormComponent
callable|bool $db_handler from  FormComponent

Methods

__construct()

FormBase constructor.

from  FormBase
append(string $name, mixed $value, bool|string $key = false)

No description

from  FormBase
void
concat(string $name, string $value)

No description

from  FormBase
mixed
destroy($name)

No description

from  FormBase
string
display_field(string $fieldName, bool $default_value = false)

Display field

string
display_field_print(string $fieldname, string $default_value = false)

Display field in print mode

mixed
get(string $name)

No description

from  FormBase
array
getConfig()

No description

from  FormBase
getDocumentSelector()

No description

string
getDomSelector()

Return Dom Selector for this field within the current form (This is NOT necessary unique if you are having 2 forms with identical names in form and field names

string
getElementVisibilityClass()

Get Element Visibility Class Formerly known as tag class

bool
getIsVisible()

Determine visibilty based on user input on dependent fields

array
getWYSIWYGCustomInserts()

No description

string
get_description()

No description

mixed
get_display_value()

returns the displayed value

array
get_group(string $prefix)

No description

from  FormBase
string
get_help_tooltip_icon()

No description

array
get_properties()

No description

from  FormBase
array|bool
get_validation_options()

No description

get_value()

No description

bool
hasCombinedInputFields()

Does this component use combined input fields which required special handling from form?

init_obj()

Initializes the form base

$this
insertAfter(FormComponent $formComponent = null)

Insert this field after the specified field

$this
insertBefore(FormComponent $formComponent = null)

Insert this field before the specified field

bool
isReadonly()

Returns TRUE if field is readonly, FALSE otherwise.

bool
is_displayed()

Checks if the field is hidden by a tag. It is important when validating

from  FormBase
void
post_process()

No description

void
process()

Process e.g. file upload, resize etc.

string
render(string|false $name = false, string|false $value = false)

No description

mixed
save()

No description

savePreProcess()

No description

$this
set(string $name, mixed $value)

No description

from  FormBase
$this
setCSSClassName(string $class = null)

Set Field Row CSS class name

$this
setCSSStyle(string $style = '')

Set Custom CSS Style

setCodeEditorTemplateMarkers(array $placeholders = [])

Use markers to enable users refer to variables when writing text. Markers will automatically be written in ###marker### Syntax Using Template Markers can break highlighting or validation on Editor Modes

setCols(int $cols = null)

Set HTML Cols attribute

$this
setCustomErrorText(string $error_msg)

Show Custom Error Message for this field

$this
setDefaultValue(mixed $value = null)

Set Field default value

$this
setDescriptionText(string $description = null)

Set Field Help Text

setDocumentSelector($documentSelectorFieldId)

No description

$this
setGridClass(string $gridClass = null)

Set Flexbox Grid Class

$this
setHelpText(string $help = null)

Set Field Help Text

setIsCodeEditor(bool $bool = true, string $language = self::CODEEditor_Language_JAVASCRIPT)

Display Textarea as codeeditor (CodeMirror)

$this
setIsDBField(bool $bool = true)

Field is to be loaded from and saved to database.

$this
setIsI18NField(bool $bool = true)

Field is considered to be translatable. This is usually determined automatically reading the instance configuration of the calling instance

setIsMarkdown(bool $isMarkdown = true, bool $allow_html = false, bool $allow_images = false, string $renderHTMLField = null)

Should content be saved as markdown?

$this
setIsReadonly(bool $bool = true)

Consider Field as readonly

$this
setIsRequired(bool $bool = true, bool $onlyRequiredIfVisible = true)

Consider Field as required

setIsWYSIWYG(bool $bool = true, string|null $toolbarSet = FormTextarea::WYSIWYGToolbar_Auto, bool $attachedToolbar = true)

Display Textarea as WYSIWYG Editor

$this
setLabel(string $label = '', string $icon_class = '', int $width_in_px = null)

Set Field label

$this
setMaxlength(int $length = null)

Set max chars for this field Array Syntax: maxlength

$this
setPlaceholder(string $title = '')

Set HTML5 Placeholder Attribute, usually visible when no data has been entered into the field

$this
setPopulateField(FormComponent $target, string $dataURL = null)

Manipulate another fields data when the value of the current field changes.

$this
setPrefixHTML(string $html = null)

Add Custom HTML before the field element

setRows(int $rows = null)

Set HTML Rows attribute

setSubmitOnCtrlEnter(bool $bool)

Enables submission of the Form if the user presses CTRL+ENTER in the textarea

$this
setSuffixHTML(string $html = null)

Add Custom HTML after the field element

setUseMention(bool $bool)

No description

setUseTag(bool $bool)

No description

$this
setVisibilityDependsOn(FormComponent $formComponent = null, array $matchingValues = [])

Set Visibility Dependency if you want your field only to be shown if another field has a specify value Array Syntax: tag, tag_source

$this
setVisibilityIsSource(bool $bool = true)

Set field to be the event source for another dependent field. Changes of this fields values will trigger events to their dependent fields and change their visibility in the frontend

$this
setWYSIWYGCustomInserts(array $inserts)

No description

setWYSIWYGInserts(DocumentIndex[]|ModelCollection $documentIndexes)

Add Document Index Entries which should be available as insert in editor.

set_display_value(mixed $value)

set the displayed value

void
set_properties(array $array)

No description

from  FormBase
set_request_vars($request)

No description

bool|string
validate()

No description

Details

in FormBase at line 31
__construct()

FormBase constructor.

The constructor is able to set an array of properties options

in FormBase at line 200
append(string $name, mixed $value, bool|string $key = false)

No description

Parameters

string $name

property name

mixed $value

property value

bool|string $key

key of property array

in FormBase at line 185
void concat(string $name, string $value)

No description

Parameters

string $name

of the property

string $value

to be concated

Return Value

void

in FormBase at line 170
mixed destroy($name)

No description

Parameters

$name

Return Value

mixed

last value

at line 36
string display_field(string $fieldName, bool $default_value = false)

Display field

Parameters

string $fieldName
bool $default_value

Return Value

string

in FormTextarea at line 505
string display_field_print(string $fieldname, string $default_value = false)

Display field in print mode

Parameters

string $fieldname
string $default_value

Return Value

string

in FormBase at line 76
mixed get(string $name)

No description

Parameters

string $name

name of the property

Return Value

mixed

in FormBase at line 83
array getConfig()

No description

Return Value

array

in FormTextarea at line 689
getDocumentSelector()

No description

in FormComponent at line 583
string getDomSelector()

Return Dom Selector for this field within the current form (This is NOT necessary unique if you are having 2 forms with identical names in form and field names

Return Value

string

Exceptions

Exception

in FormComponent at line 595
protected string getElementVisibilityClass()

Get Element Visibility Class Formerly known as tag class

Return Value

string

in FormComponent at line 496
bool getIsVisible()

Determine visibilty based on user input on dependent fields

Return Value

bool

True if considered visible

in FormTextarea at line 668
array getWYSIWYGCustomInserts()

No description

Return Value

array

[]['group' => 'Name', 'link' => ['label'=>'', 'snippet' =>'' ], 'preview' => ['label'=>'', 'snippet' =>'']]

in FormTextarea at line 660
DocumentIndex[]|ModelCollection getWYSIWYGInserts()

No description

in FormComponent at line 168
string get_description()

No description

Return Value

string

html or false if no description is set

in FormComponent at line 274
mixed get_display_value()

returns the displayed value

Return Value

mixed

value

in FormBase at line 219
array get_group(string $prefix)

No description

Parameters

string $prefix

prefix (e.g. mygroup_ )

Return Value

array

in FormComponent at line 149
string get_help_tooltip_icon()

No description

Return Value

string

html or false if no help is set

in FormBase at line 91
array get_properties()

No description

Return Value

array

in FormComponent at line 47
array|bool get_validation_options()

No description

Return Value

array|bool

validation options, false on failure

in FormComponent at line 187
get_value()

No description

in FormComponent at line 39
bool hasCombinedInputFields()

Does this component use combined input fields which required special handling from form?

Return Value

bool

at line 14
init_obj()

Initializes the form base

in FormComponent at line 544
$this insertAfter(FormComponent $formComponent = null)

Insert this field after the specified field

Parameters

FormComponent $formComponent

Return Value

$this

in FormComponent at line 529
$this insertBefore(FormComponent $formComponent = null)

Insert this field before the specified field

Parameters

FormComponent $formComponent

Return Value

$this

in FormComponent at line 369
bool isReadonly()

Returns TRUE if field is readonly, FALSE otherwise.

Return Value

bool

in FormBase at line 239
bool is_displayed()

Checks if the field is hidden by a tag. It is important when validating

Return Value

bool

in FormComponent at line 257
void post_process()

No description

Return Value

void

in FormTextarea at line 97
void process()

Process e.g. file upload, resize etc.

Return Value

void

in FormComponent at line 198
string render(string|false $name = false, string|false $value = false)

No description

Parameters

string|false $name
string|false $value

Return Value

string

in FormTextarea at line 51
mixed save()

No description

Return Value

mixed

in FormTextarea at line 109
savePreProcess()

No description

in FormBase at line 103
$this set(string $name, mixed $value)

No description

Parameters

string $name

propoerty name

mixed $value

property value

Return Value

$this

in FormComponent at line 391
$this setCSSClassName(string $class = null)

Set Field Row CSS class name

Parameters

string $class

e.g. hide_label, error

Return Value

$this

in FormTextarea at line 551
$this setCSSStyle(string $style = '')

Set Custom CSS Style

Parameters

string $style

e.g. width:100px;

Return Value

$this

in FormTextarea at line 642
FormTextarea setCodeEditorTemplateMarkers(array $placeholders = [])

Use markers to enable users refer to variables when writing text. Markers will automatically be written in ###marker### Syntax Using Template Markers can break highlighting or validation on Editor Modes

Parameters

array $placeholders

Assoc array e.g. ['firstname'=>_("Firstname of user")] , you can also use a second dimension to group markers

Return Value

FormTextarea

in FormTextarea at line 517
FormTextarea setCols(int $cols = null)

Set HTML Cols attribute

Parameters

int $cols

Return Value

FormTextarea

in FormComponent at line 559
$this setCustomErrorText(string $error_msg)

Show Custom Error Message for this field

Parameters

string $error_msg

Return Value

$this

in FormComponent at line 380
$this setDefaultValue(mixed $value = null)

Set Field default value

Parameters

mixed $value

Return Value

$this

in FormComponent at line 413
$this setDescriptionText(string $description = null)

Set Field Help Text

Parameters

string $description

String to help people understand this fields value and options

Return Value

$this

in FormTextarea at line 683
setDocumentSelector($documentSelectorFieldId)

No description

Parameters

$documentSelectorFieldId

in FormComponent at line 573
$this setGridClass(string $gridClass = null)

Set Flexbox Grid Class

Parameters

string $gridClass

Example: xcol-6_md-12

Return Value

$this

in FormComponent at line 402
$this setHelpText(string $help = null)

Set Field Help Text

Parameters

string $help

String to help people fill out your form

Return Value

$this

in FormTextarea at line 630
FormTextarea setIsCodeEditor(bool $bool = true, string $language = self::CODEEditor_Language_JAVASCRIPT)

Display Textarea as codeeditor (CodeMirror)

Parameters

bool $bool
string $language

Generally refers to Codemirror modes, Use constants for easier reference

Return Value

FormTextarea

in FormComponent at line 336
$this setIsDBField(bool $bool = true)

Field is to be loaded from and saved to database.

Parameters

bool $bool

Return Value

$this

in FormComponent at line 349
$this setIsI18NField(bool $bool = true)

Field is considered to be translatable. This is usually determined automatically reading the instance configuration of the calling instance

Parameters

bool $bool

Return Value

$this

in FormTextarea at line 607
FormTextarea setIsMarkdown(bool $isMarkdown = true, bool $allow_html = false, bool $allow_images = false, string $renderHTMLField = null)

Should content be saved as markdown?

Parameters

bool $isMarkdown

True = Textarea contains markdown

bool $allow_html

No HTML should be stored in the database, Content will be converted using reverse markdown

bool $allow_images

Markdown conversion generally allows for Images, but for security reasons you might want to sanitize this too

string $renderHTMLField

By default the field associated with this textarea will get the markdown text. You can optionally specify a second field to store the raw html for output

Return Value

FormTextarea

in FormComponent at line 360
$this setIsReadonly(bool $bool = true)

Consider Field as readonly

Parameters

bool $bool

Return Value

$this

in FormComponent at line 325
$this setIsRequired(bool $bool = true, bool $onlyRequiredIfVisible = true)

Consider Field as required

Parameters

bool $bool
bool $onlyRequiredIfVisible

If field is used with dependent visibility we consider the field only required when the field was visible to the user

Return Value

$this

in FormTextarea at line 584
FormTextarea setIsWYSIWYG(bool $bool = true, string|null $toolbarSet = FormTextarea::WYSIWYGToolbar_Auto, bool $attachedToolbar = true)

Display Textarea as WYSIWYG Editor

Parameters

bool $bool
string|null $toolbarSet

One of the FormTextarea::WYSIWYG* constants.

bool $attachedToolbar

Show Toolbar inline? Or attached?

Return Value

FormTextarea

in FormComponent at line 311
$this setLabel(string $label = '', string $icon_class = '', int $width_in_px = null)

Set Field label

Parameters

string $label
string $icon_class

CSS Icon class, e.g. icon-time

int $width_in_px

Return Value

$this

in FormTextarea at line 540
$this setMaxlength(int $length = null)

Set max chars for this field Array Syntax: maxlength

Parameters

int $length

Return Value

$this

in FormTextarea at line 562
$this setPlaceholder(string $title = '')

Set HTML5 Placeholder Attribute, usually visible when no data has been entered into the field

Parameters

string $title

Return Value

$this

in FormComponent at line 448
$this setPopulateField(FormComponent $target, string $dataURL = null)

Manipulate another fields data when the value of the current field changes.

Common usage: Populate a second select once user chooses from the first select

Parameters

FormComponent $target
string $dataURL

Return Value

$this

in FormComponent at line 424
$this setPrefixHTML(string $html = null)

Add Custom HTML before the field element

Parameters

string $html

e.g. 'http:// '

Return Value

$this

in FormTextarea at line 528
FormTextarea setRows(int $rows = null)

Set HTML Rows attribute

Parameters

int $rows

Return Value

FormTextarea

in FormTextarea at line 492
FormTextarea setSubmitOnCtrlEnter(bool $bool)

Enables submission of the Form if the user presses CTRL+ENTER in the textarea

Parameters

bool $bool

Return Value

FormTextarea

in FormComponent at line 435
$this setSuffixHTML(string $html = null)

Add Custom HTML after the field element

Parameters

string $html

e.g. ' hours'

Return Value

$this

in FormTextarea at line 474
FormTextarea setUseMention(bool $bool)

No description

Parameters

bool $bool

Return Value

FormTextarea

in FormTextarea at line 482
FormTextarea setUseTag(bool $bool)

No description

Parameters

bool $bool

Return Value

FormTextarea

in FormComponent at line 462
$this setVisibilityDependsOn(FormComponent $formComponent = null, array $matchingValues = [])

Set Visibility Dependency if you want your field only to be shown if another field has a specify value Array Syntax: tag, tag_source

Parameters

FormComponent $formComponent

Null will reset and remove all existing dependencies

array $matchingValues

Field will be shown/visible if the dependent field contains/has one of the values specified

Return Value

$this

in FormComponent at line 486
$this setVisibilityIsSource(bool $bool = true)

Set field to be the event source for another dependent field. Changes of this fields values will trigger events to their dependent fields and change their visibility in the frontend

Fields are automatically set to be a source if used in a call of setVisibilityDependsOn()

Array Syntax: tag_source

Parameters

bool $bool

Return Value

$this

in FormTextarea at line 678
$this setWYSIWYGCustomInserts(array $inserts)

No description

Parameters

array $inserts

[]['group' => 'Name', 'link' => ['label'=>'', 'snippet' =>'' ], 'preview' => ['label'=>'', 'snippet' =>'']]

Return Value

$this

in FormTextarea at line 652
FormTextarea setWYSIWYGInserts(DocumentIndex[]|ModelCollection $documentIndexes)

Add Document Index Entries which should be available as insert in editor.

NOTE: When using the setDocumentSelector() all documents from the Selector will automatically be available

Parameters

DocumentIndex[]|ModelCollection $documentIndexes

Document indexes which should be visible for insert in the editor (images, links (e.g. downloads))

Return Value

FormTextarea

in FormComponent at line 265
set_display_value(mixed $value)

set the displayed value

Parameters

mixed $value

value

in FormBase at line 155
void set_properties(array $array)

No description

Parameters

array $array

associated array like property=>value

Return Value

void

in FormComponent at line 31
set_request_vars($request)

No description

Parameters

$request

in FormTextarea at line 29
bool|string validate()

No description

Return Value

bool|string

True if data is considered valid. String for specific error message. Empty string will also evaluate as valid.