File extends Base
File Must use: File::getPostWithFiles before using this type!
Table of Contents
Constants
- MULTITAG = 'div'
Methods
- asMultiple() : mixed
- asSingle() : mixed
- Get single value.
- getEditHtml() : mixed
- getEditHtmlInsert() : mixed
- getEditHtmlSingle() : string
- getEditHtmlSingleAfterInsert() : mixed
- getEditHtmlSingleDelete() : mixed
- getError() : mixed
- getErrorSingle() : mixed
- getFilterEditHtml() : string
- getPostWithFiles() : array<string|int, mixed>
- Normalize $_FILES structure and join it with $_POST.
- getRequiredError() : array<string|int, mixed>
- getSettings() : mixed
- getValue() : mixed
- getValueSingle() : mixed
- getViewHtml() : mixed
- getViewHtmlSingle() : mixed
- hasMultipleValuesSupport() : bool
- isDeletedSingle() : bool
- Check if file is marked for deletion.
- isMultiple() : bool
- Check if value is multiple.
- isUploadedSingle() : bool
- Check if file is uploaded.
- loadInfo() : array<string|int, mixed>
- loadInfoSingle() : mixed
- deprecated
Constants
MULTITAG
public
mixed
MULTITAG
= 'div'
Methods
asMultiple()
public
static asMultiple(mixed $value) : mixed
Parameters
- $value : mixed
asSingle()
Get single value.
public
static asSingle(mixed $value) : mixed
Parameters
- $value : mixed
Return values
mixed —- if value is multiple, get first meaningful value (which is not null)
getEditHtml()
public
static getEditHtml(mixed $name, array<string|int, mixed> $input[, mixed $value = null ]) : mixed
Parameters
- $name : mixed
- $input : array<string|int, mixed>
- $value : mixed = null
getEditHtmlInsert()
public
static getEditHtmlInsert(mixed $tag, mixed $replace, mixed $name, mixed $sample, mixed $after) : mixed
Parameters
- $tag : mixed
- $replace : mixed
- $name : mixed
- $sample : mixed
- $after : mixed
getEditHtmlSingle()
public
static getEditHtmlSingle(mixed $name, array<string|int, mixed> $input, mixed $value) : string
Parameters
- $name : mixed
- $input : array<string|int, mixed>
- $value : mixed
Return values
stringgetEditHtmlSingleAfterInsert()
public
static getEditHtmlSingleAfterInsert() : mixed
getEditHtmlSingleDelete()
public
static getEditHtmlSingleDelete(mixed $name, array<string|int, mixed> $input) : mixed
Parameters
- $name : mixed
- $input : array<string|int, mixed>
getError()
public
static getError(array<string|int, mixed> $input, mixed $value) : mixed
Parameters
- $input : array<string|int, mixed>
- $value : mixed
getErrorSingle()
public
static getErrorSingle(array<string|int, mixed> $input, mixed $value) : mixed
Parameters
- $input : array<string|int, mixed>
- $value : mixed
getFilterEditHtml()
public
static getFilterEditHtml(mixed $name, array<string|int, mixed> $input, mixed $value) : string
Parameters
- $name : mixed
- $input : array<string|int, mixed>
- $value : mixed
Return values
stringgetPostWithFiles()
Normalize $_FILES structure and join it with $_POST.
public
static getPostWithFiles(array<string|int, mixed> $post, array<string|int, mixed> $files) : array<string|int, mixed>
Must be called before using File type!
PHP default $_FILES structure:
Array([name] => Array([0] => photo.jpg , [1] => ) [type] => Array([0] => image/jpeg , [1] => ) [tmp_name] => Array([0] => /tmp/dsk4le5se, [1] => ) [error] => Array([0] => 0 , [1] => 4) [size] => Array([0] => 45673 , [1] => 0))
Normalized files structure:
Array( [0] => Array( [name] => photo.jpg [type] => image/jpeg [tmp_name] => /tmp/dsk4le5se [error] => 0 [size] => 45673 ) [1] => Array( [name] => [type] => [tmp_name] => [error] => 4 [size] => ) )
Example: - will be normalized as expected in post
Parameters
- $post : array<string|int, mixed>
-
- $_POST
- $files : array<string|int, mixed>
-
- $_FILES
Return values
array<string|int, mixed> —- post + fixed files
getRequiredError()
public
static getRequiredError(array<string|int, mixed> $input, mixed $value) : array<string|int, mixed>
Parameters
- $input : array<string|int, mixed>
- $value : mixed
Return values
array<string|int, mixed>getSettings()
public
static getSettings(array<string|int, mixed> $input, mixed $reload) : mixed
Parameters
- $input : array<string|int, mixed>
- $reload : mixed
getValue()
public
static getValue(array<string|int, mixed> $input, mixed $value) : mixed
Parameters
- $input : array<string|int, mixed>
- $value : mixed
getValueSingle()
public
static getValueSingle(array<string|int, mixed> $input, mixed $value) : mixed
Parameters
- $input : array<string|int, mixed>
- $value : mixed
getViewHtml()
public
static getViewHtml(array<string|int, mixed> $input[, mixed $value = null ]) : mixed
Parameters
- $input : array<string|int, mixed>
- $value : mixed = null
getViewHtmlSingle()
public
static getViewHtmlSingle(array<string|int, mixed> $input, mixed $value) : mixed
Parameters
- $input : array<string|int, mixed>
- $value : mixed
hasMultipleValuesSupport()
public
static hasMultipleValuesSupport() : bool
Return values
boolisDeletedSingle()
Check if file is marked for deletion.
public
static isDeletedSingle(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolisMultiple()
Check if value is multiple.
public
static isMultiple(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolisUploadedSingle()
Check if file is uploaded.
public
static isUploadedSingle(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolloadInfo()
public
static loadInfo(mixed $value) : array<string|int, mixed>
Load file array from database.
Parameters
- $value : mixed
Return values
array<string|int, mixed> —- file array
loadInfoSingle()
deprecated
public
static loadInfoSingle(mixed $file) : mixed
Parameters
- $file : mixed