CFIServerDocuments
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- CFI constructor.
- acceptedFiles() : CFIServerDocuments
- It says what kind of files, or extensions will be accepted
- addDocument() : CFIServerDocuments
- Assign default values to the document definitions
- allowDelete() : CFIServerDocuments
- Set the allow_delete field value of the object.
- allowEdit() : CFIServerDocuments
- Set the allow_edit field value of the object.
- allowView() : CFIServerDocuments
- Set the allow_view field value of the object.
- bigFilesPath() : CFIServerDocuments
- Add bigFiles property to the field to allow Big Upload Files
- bucket() : CFIServerDocuments
- Assign the bucket where to store the files. IT should starts with gs:// ot it will add it to $bucket
- endPointToGetUrlForUploading() : CFIServerDocuments
- Method to tell what ENDPOINT to call for Uploading URL
- folder() : CFIServerDocuments
- Assign the folder where to store the files inside $this->field['bucket']
- maxFileSize() : CFIServerDocuments
- It says the max file size accepted (in bytes). By default is 5242880 bytes
- multiple() : CFIServerDocuments
- It says if it allows multiple files
- processCloudFrameworkDocuments() : CFIServerDocuments
- Process an array of files with the structure of CloudFrameWorkDocuments and add it as documents in the field
- readDocsFromCFO() : mixed
- Read documents from a specific Cloud Framework Object (CFO) and add them to the specified field.
Properties
$field
public
mixed
$field
$core
private
Core7
$core
Methods
__construct()
CFI constructor.
public
__construct(Core7 &$core, array<string|int, mixed> &$field) : mixed
Parameters
- $core : Core7
- $field : array<string|int, mixed>
acceptedFiles()
It says what kind of files, or extensions will be accepted
public
acceptedFiles(string $files_type) : CFIServerDocuments
Parameters
- $files_type : string
-
example: image/*,application/pdf,.psd
Return values
CFIServerDocuments —$this
addDocument()
Assign default values to the document definitions
public
addDocument(array<string|int, mixed> $doc) : CFIServerDocuments
Parameters
- $doc : array<string|int, mixed>
-
Document structure $doc['id'] Id of the document $doc['date'] Date of creation $doc['name'] Name of the document $doc['size'] Size of the document $doc['file_type'] File type of the document $doc['url'] URL to download the document $doc['url_delete'] URL to delete the document $doc['url_edit'] URL to update properties of the document
Return values
CFIServerDocuments —$this
allowDelete()
Set the allow_delete field value of the object.
public
allowDelete([bool $allow = true ]) : CFIServerDocuments
Parameters
- $allow : bool = true
-
Indicates whether deletion is allowed or not. Default value is true.
Return values
CFIServerDocuments —$this
allowEdit()
Set the allow_edit field value of the object.
public
allowEdit([bool $allow = true ]) : CFIServerDocuments
Parameters
- $allow : bool = true
-
Indicates whether file name edit is allowed or not. Default value is true.
Return values
CFIServerDocuments —$this
allowView()
Set the allow_view field value of the object.
public
allowView([bool $allow = true ]) : CFIServerDocuments
Parameters
- $allow : bool = true
-
Indicates whether view file is allowed or not. Default value is true.
Return values
CFIServerDocuments —$this
bigFilesPath()
Add bigFiles property to the field to allow Big Upload Files
public
bigFilesPath(string $path) : CFIServerDocuments
Parameters
- $path : string
-
It has to start with '/path'
Return values
CFIServerDocuments —$this
bucket()
Assign the bucket where to store the files. IT should starts with gs:// ot it will add it to $bucket
public
bucket(string $buket) : CFIServerDocuments
Parameters
- $buket : string
Return values
CFIServerDocuments —$this
endPointToGetUrlForUploading()
Method to tell what ENDPOINT to call for Uploading URL
public
endPointToGetUrlForUploading(string $url_to_upload) : CFIServerDocuments
Parameters
- $url_to_upload : string
-
ENDPOINT to get the URL to upload a file
Return values
CFIServerDocuments —$this
folder()
Assign the folder where to store the files inside $this->field['bucket']
public
folder(string $folder) : CFIServerDocuments
Parameters
- $folder : string
Return values
CFIServerDocuments —$this
maxFileSize()
It says the max file size accepted (in bytes). By default is 5242880 bytes
public
maxFileSize(int $size) : CFIServerDocuments
Parameters
- $size : int
-
max file size in bytes example: 5242880
Return values
CFIServerDocuments —$this
multiple()
It says if it allows multiple files
public
multiple([bool $allow_multiple = true ]) : CFIServerDocuments
Parameters
- $allow_multiple : bool = true
Return values
CFIServerDocuments —$this
processCloudFrameworkDocuments()
Process an array of files with the structure of CloudFrameWorkDocuments and add it as documents in the field
public
processCloudFrameworkDocuments(array<string|int, mixed> $files) : CFIServerDocuments
Parameters
- $files : array<string|int, mixed>
Return values
CFIServerDocuments —$this
readDocsFromCFO()
Read documents from a specific Cloud Framework Object (CFO) and add them to the specified field.
public
readDocsFromCFO(string $cfo, string $field, string $id[, string $url = 'https://api.cloudframework.io/core/cfo/cfi' ][, array<string|int, mixed> $headers = [] ]) : mixed
Parameters
- $cfo : string
-
The name of the Cloud Framework Object (CFO).
- $field : string
-
The name of the field to add the documents to.
- $id : string
-
The ID of the specific document.
- $url : string = 'https://api.cloudframework.io/core/cfo/cfi'
-
The URL to the Cloud Framework API endpoint. Default is 'https://api.cloudframework.io/core/cfo/cfi'.
- $headers : array<string|int, mixed> = []
-
Additional headers to be sent with the API request. By Default is an empty array so it will send X-WEB-KEY and X-DS-TOKEN from headers if it exists