FormDocument
class FormDocument extends FormComponent
Class FormDocument
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
No description
Helper method that can be used to add additional arguments as parameters for requests made when documents are added or changed.
Adds a DOM selector which is used to pasting clip board content.
Clears (remove) the temp folder
Converts the value as string representation into an array with values.
Renders the GUI
Display field in print mode
No description
Returns the default value for this component.
Returns the separator of multiple values.
Returns if the user is allowed to select links
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
Get Element Visibility Class Formerly known as tag class
Returns the settings for the image edit functionality.
Returns the preview image height based on the display mode and cropping. This is used to resize images on the server depending on the required frontend size
Returns the preview image width based on the display mode. This is used to resize images on the server depending on the required frontend size
Returns the current image preview size
Returns a relative location path.
No description
Returns an icon to reflect the possible file types
Returns a message which is displayed when no document is selected.
Returns whether client side upload listener should be attached or not.
Returns a string that contains a js callback function name.
Returns a document model.
Returns a DOM selector which is used to pasting clip board content.
This option is used by the replace location with id method.
Returns whether a submit should be triggered after a document selection.
Returns a custom label name for the upload field.
Returns the storage path where to save files.
No description
No description
Get a unique DOM ID Replaces . with _ to prevent possible ambiguous ID's like #form_id.cms_comp
No description
Does this component use combined input fields which required special handling from form?
Return if the component should be shown as required with specified style class.
Initialize the component, loading all dependent instances and required JS and CSS files
This class provides an automated handling for storing attached / uploaded documents. This handling will be triggered on save and if this option (auto store) is TRUE.
Returns whether changes to attachments should trigger a form submit.
Returns TRUE if this component supports multiple document selection.
Returns TRUE if the values of this component are serialized.
Checks if the field is hidden by a tag. It is important when validating
No description
Process the component, storing provided files in a temporary folder
No description
Returns the THUMB HTML. The iconClass is the fallback if no thumbURL is provided
Generates a list of selection items, as provided in the argument
Serializes the selection, saving temporary files in the xfs file system
Set the allow file extensions which can be uploaded.
Enable filter of input to accept image types
Enable filter of input to accept video types
Set TRUE to let this class handle the attached / uploaded documents. The handling will be triggered on save.
Show Custom Error Message for this field
Sets the separator for multiple values.
Disable the selector to allow the user to select existing documents / links
Sets whether changes to attachments should trigger a form submit.
Sets the image edit settings for cropping function.
Sets the configuration for image editing.
Sets a fixed image preview size which will be used for single image selects
Field is to be loaded from and saved to database.
Field is considered to be translatable. This is usually determined automatically reading the instance configuration of the calling instance
Consider Field as required
Sets a relative location path.
No description
Sets whether this component supports multiple documents.
Sets a message which is displayed when no document is selected.
Sets whether client side upload listener should be attached or not.
Sets a js callback function name.
Set the source element which should be checked for File Uploads by Copy&Paste Events
Sets a DOM selector which is used to pasting clip board content.
Manipulate another fields data when the value of the current field changes.
Add Custom HTML before the field element
Set TRUE to use cascaded folder.
Sets whether a submit should be triggered after a document selection.
If TRUE, field values will be saved serialized.
Sets a custom label name for upload field.
Set Visibility Dependency if you want your field only to be shown if another field has a specify value Array Syntax: tag, tag_source
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
Sets the path to the storage where to save files on upload.
Validate Attachments
Should this field be marked with HTML5 required attribute? HTML5 required should not be used when field may be hidden, as it might still be required frontend-wise, even if hidden!
Should this field be treated as required during request validation?
Details
in
FormBase at line 31
__construct()
FormBase constructor.
The constructor is able to set an array of properties options
at line 1615
_cb_handle_new_document($instance_id, $hook_name, $name)
No description
at line 2430
FormDocument
addAdditionalUploadParam(string $key, string $value)
Helper method that can be used to add additional arguments as parameters for requests made when documents are added or changed.
at line 592
FormDocument
addPasteSource(string $pasteSource)
Adds a DOM selector which is used to pasting clip board content.
This parameter will be pass to the client JS engine vor evaluating.
IMPORTANT: Make sure that the pasteSource only uses DOTs as CSS selectors not part of the name.
in
FormBase at line 198
append(string $name, mixed $value, bool|string $key = false)
No description
at line 736
clear()
Clears (remove) the temp folder
in
FormBase at line 183
void
concat(string $name, string $value)
No description
at line 202
protected array
convertDefaultValue(string $value)
Converts the value as string representation into an array with values.
This is e.g. used to convert default value to an array with values which can be evaluated by process and save method. This method considers the serialization option and uses the defined value separator.
in
FormBase at line 168
mixed
destroy($name)
No description
at line 1212
string
display_field(mixed $fieldname, mixed $default_value = false)
Renders the GUI
at line 1604
string
display_field_print(string $fieldname, string $default_value = false)
Display field in print mode
in
FormBase at line 77
mixed
get(string $name)
No description
at line 2407
array
getAdditionalUploadParams()
No description
in
FormBase at line 84
array
getConfig()
No description
at line 178
array
getDefault()
Returns the default value for this component.
This method considers the model set on the form. If the model is set, it will prefer the value from model instead of the default value set by option setter. This method uses the convert method to ensure to return a valid default value.
at line 249
string
getDelimiter()
Returns the separator of multiple values.
This separator is used for multiple values which are not serialized. This shouldn't be used together with serialization.
at line 807
bool
getDisableLinks()
Returns if the user is allowed to select links
in
FormComponent at line 588
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
in
FormComponent at line 600
protected string
getElementVisibilityClass()
Get Element Visibility Class Formerly known as tag class
at line 274
array
getImageEditSettings()
Returns the settings for the image edit functionality.
The settings contains options for different image edit types.
at line 375
protected int
getImagePreviewResizeHeight()
Returns the preview image height based on the display mode and cropping. This is used to resize images on the server depending on the required frontend size
at line 367
protected int
getImagePreviewResizeWidth()
Returns the preview image width based on the display mode. This is used to resize images on the server depending on the required frontend size
at line 358
string
getImagePreviewSize()
Returns the current image preview size
in
FormComponent at line 501
bool
getIsVisible()
Determine visibilty based on user input on dependent fields
in
FormComponent at line 317
string
getLabel()
Get Field label
at line 633
string|null
getLocation()
Returns a relative location path.
The relative location path is used to determine the exact destination path inside of the web dir.
at line 745
string
getMinReferenceLevel()
No description
at line 460
string
getNoDocumentIcon()
Returns an icon to reflect the possible file types
at line 445
string
getNoDocumentMessage()
Returns a message which is displayed when no document is selected.
at line 503
bool
getNoUpload()
Returns whether client side upload listener should be attached or not.
at line 606
string|null
getOnChange()
Returns a string that contains a js callback function name.
This callback will be triggered when the attachments are changed. This parameter will be pass to the client JS engine vor evaluating.
at line 409
DocumentModel|null
getOwnerDocument()
Returns a document model.
This document model is used as parent model for attached documents. This document model will be the owner of all documents that will be attached or uploaded.
at line 549
string|null
getPasteSource()
Returns a DOM selector which is used to pasting clip board content.
at line 686
bool
getSaveInCascadedFolder()
This option is used by the replace location with id method.
Returns TRUE if the id should be cascaded (e.g. k1 for 10.000 - 19.999)
at line 715
bool
getSelectorAutoSubmit()
Returns whether a submit should be triggered after a document selection.
This options will be pass to the client to trigger the client side submit.
at line 474
string
getUploadLabel()
Returns a custom label name for the upload field.
at line 661
string|null
getWebDir()
Returns the storage path where to save files.
If this form component does not provide a web dir then this method will return the web dir defined in the form or null if no one is defined.
in
FormComponent at line 156
string
get_description()
No description
in
FormComponent at line 257
mixed
get_display_value()
returns the displayed value
in
FormBase at line 217
array
get_group(string $prefix)
No description
at line 2248
array
get_items()
No description
in
FormBase at line 92
array
get_properties()
No description
at line 827
protected string
get_tmp_folder(null|string $process_id = null)
No description
at line 818
string
get_unique_dom_id()
Get a unique DOM ID Replaces . with _ to prevent possible ambiguous ID's like #form_id.cms_comp
at line 2091
XfsDocument[]
get_uploaded_documents()
No description
in
FormComponent at line 56
array|bool
get_validation_options()
No description
in
FormComponent at line 175
get_value()
No description
in
FormComponent at line 48
bool
hasCombinedInputFields()
Does this component use combined input fields which required special handling from form?
in
FormComponent at line 651
protected bool
hasRequiredStyle()
Return if the component should be shown as required with specified style class.
at line 122
void
init()
Initialize the component, loading all dependent instances and required JS and CSS files
in
FormBase at line 39
init_obj()
Initializes the form base
in
FormComponent at line 549
$this
insertAfter(FormComponent $formComponent = null)
Insert this field after the specified field
in
FormComponent at line 534
$this
insertBefore(FormComponent $formComponent = null)
Insert this field before the specified field
at line 147
bool
isAutoStore()
This class provides an automated handling for storing attached / uploaded documents. This handling will be triggered on save and if this option (auto store) is TRUE.
at line 526
bool
isFormSubmitOnChange()
Returns whether changes to attachments should trigger a form submit.
This parameter will be pass to the client JS engine vor evaluating.
at line 385
bool
isMultiple()
Returns TRUE if this component supports multiple document selection.
in
FormComponent at line 374
bool
isReadonly()
Returns TRUE if field is readonly, FALSE otherwise.
at line 223
bool
isSerialized()
Returns TRUE if the values of this component are serialized.
in
FormBase at line 237
bool
is_displayed()
Checks if the field is hidden by a tag. It is important when validating
at line 2255
void
post_process()
No description
at line 842
void
process()
Process the component, storing provided files in a temporary folder
in
FormComponent at line 187
string
render(string|false $name = false, string|false $value = false)
No description
at line 1653
protected string
renderThumb(string $thumbUrl, $filetypeClass = false, $tooltip = false)
Returns the THUMB HTML. The iconClass is the fallback if no thumbURL is provided
at line 1680
protected mixed|string
render_selected_documents(bool $file_ids = false)
Generates a list of selection items, as provided in the argument
at line 2098
mixed
save()
Serializes the selection, saving temporary files in the xfs file system
in
FormBase at line 104
$this
set(string $propertyName, mixed $propertyValue)
No description
at line 785
$this
setAllowFileExtension(string ...$fileExtensions)
Set the allow file extensions which can be uploaded.
at line 764
FormDocument
setAllowImage($allowImage = true)
Enable filter of input to accept image types
at line 774
FormDocument
setAllowVideo($allowVideo = true)
Enable filter of input to accept video types
at line 159
FormDocument
setAutoStore(bool $bool)
Set TRUE to let this class handle the attached / uploaded documents. The handling will be triggered on save.
in
FormComponent at line 396
$this
setCSSClassName(string $class = null)
Set Field Row CSS class name
in
FormComponent at line 564
$this
setCustomErrorText(string $error_msg)
Show Custom Error Message for this field
in
FormComponent at line 385
FormComponent
setDefaultValue(mixed $value = null)
Set Field default value
at line 262
FormDocument
setDelimiter(string $delimiter = ',')
Sets the separator for multiple values.
This method affects operation only when no serialization is used.
in
FormComponent at line 418
$this
setDescriptionText(string $description = null)
Set Field Help Text
at line 798
FormDocument
setDisableLinks($allowLinks = true)
Disable the selector to allow the user to select existing documents / links
at line 539
FormDocument
setFormSubmitOnChange(bool $bool)
Sets whether changes to attachments should trigger a form submit.
Old Param: commit_on_change
in
FormComponent at line 578
$this
setGridClass(string $gridClass = null)
Set Flexbox Grid Class
in
FormComponent at line 407
$this
setHelpText(string $help = null)
Set Field Help Text
at line 289
FormDocument
setImageCropperSettings(string $aspectRatio, bool $roundShape = false, array $minimumSize = [])
Sets the image edit settings for cropping function.
at line 338
FormDocument
setImageEditorSettings(array $settings)
Sets the configuration for image editing.
If this settings are set, the image edit will be enabled. The settings contains options for different image edit types. This method should only used to pass automated created settings. For custom use of settings use the specific image edit type settings.
at line 349
FormDocument
setImagePreviewSize($size)
Sets a fixed image preview size which will be used for single image selects
in
FormComponent at line 341
$this
setIsDBField(bool $bool = true)
Field is to be loaded from and saved to database.
in
FormComponent at line 354
$this
setIsI18NField(bool $bool = true)
Field is considered to be translatable. This is usually determined automatically reading the instance configuration of the calling instance
in
FormComponent at line 365
$this
setIsReadonly(bool $bool = true)
Consider Field as readonly
in
FormComponent at line 330
$this
setIsRequired(bool $bool = true, bool $onlyRequiredIfVisible = true)
Consider Field as required
in
FormComponent at line 293
$this
setLabel(string $label = '', string $icon_class = null)
Set Field label
in
FormComponent at line 308
$this
setLabelIconClass(string $icon_class = '')
Set label icon class
at line 647
FormDocument
setLocation(string $location)
Sets a relative location path.
The relative location path is used to determine the exact destination path inside of the web dir.
at line 752
setMinReferenceLevel(string $level)
No description
at line 396
FormDocument
setMultiple(bool $bool)
Sets whether this component supports multiple documents.
at line 435
FormDocument
setNoDocumentMessage(string $message)
Sets a message which is displayed when no document is selected.
at line 514
FormDocument
setNoUpload(bool $bool)
Sets whether client side upload listener should be attached or not.
at line 620
FormDocument
setOnChange(string $onChange)
Sets a js callback function name.
This callback will be triggered when the attachments are changed. This parameter will be pass to the client JS engine vor evaluating.
at line 423
FormDocument
setOwnerDocument(DocumentModel $document)
Sets a document model.
This document model is used as parent model for attached documents. This document model will be the owner of all documents that will be attached or uploaded.
at line 560
FormDocument
setPasteSource(FormComponent $pasteSource)
Set the source element which should be checked for File Uploads by Copy&Paste Events
at line 576
FormDocument
setPasteSourceDomSelector(string $cssSelector)
Sets a DOM selector which is used to pasting clip board content.
This parameter will be pass to the client JS engine vor evaluating.
IMPORTANT: Make sure that the pasteSource only uses DOTs as CSS selectors not part of the name.
in
FormComponent at line 453
$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
in
FormComponent at line 429
$this
setPrefixHTML(string $html = null)
Add Custom HTML before the field element
at line 703
FormDocument
setSaveInCascadedFolder(bool $bool)
Set TRUE to use cascaded folder.
Cascaded folder are used to avoid long id folder names. This is used by replace id in location method.
at line 728
FormDocument
setSelectorAutoSubmit(bool $bool)
Sets whether a submit should be triggered after a document selection.
This options will be pass to the client to trigger the client side submit.
at line 234
FormDocument
setSerialize(bool $bool)
If TRUE, field values will be saved serialized.
in
FormComponent at line 440
$this
setSuffixHTML(string $html = null)
Add Custom HTML after the field element
at line 492
FormDocument
setUploadLabel(string $label)
Sets a custom label name for upload field.
in
FormComponent at line 467
$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
in
FormComponent at line 491
$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
at line 672
FormDocument
setWebDir(string $webDir)
Sets the path to the storage where to save files on upload.
in
FormComponent at line 248
set_display_value(mixed $value)
set the displayed value
in
FormBase at line 153
void
set_properties(array $array)
No description
in
FormComponent at line 40
set_request_vars($request)
No description
at line 1454
array
validate()
Validate Attachments
in
FormComponent at line 639
protected bool
validateInFrontendAsRequired()
Should this field be marked with HTML5 required attribute? HTML5 required should not be used when field may be hidden, as it might still be required frontend-wise, even if hidden!
in
FormComponent at line 624
protected bool
validateInRequestAsRequired()
Should this field be treated as required during request validation?