ModelFiles module

File

A model in the Files module, with 19 members for templates, 14 API properties and 19 members for admin templates.

Files\Models\Frontend\File Files\Models\Api\File Files\Models\Backend\File Also in Files: FavoriteFilename FavoriteFolder FileRevision Filename FilenameComment Folder FolderComment Image ImageRevision SharedFilename VirtualFile
View
What Smarty and Twig templates receive. Properties in REST API responses and job payloads. What admin screen templates receive when you override them.

Templates view

Properties 18

Take no arguments.

# __toString() Templates only
string
Get the string representation of the file, which is the file path
# getPath()
string
Get the path for this file
# getFullPath()
string
Get the full path for this file. Alias for getPath.
# getType()
?string
Get the type of the file. Tries to determine the file type based on the active revision's virtual file type.
# getPreviewImage()
?Image
Get a preview image for the file. Returns null if no preview image exists.
# getId()
?int
# getCreated()
?DateTime
Get the date the record was created.
# getModified()
?DateTime
Get the last modification date for the record.
# getFilename()
?Filename
# getActiveRevision()
?FileRevision
# getTags()
?Collection<Tag>
# getCategories()
?Collection<Category>
# getRevisions()
?Collection<FileRevision>
# getLastRevision()
?FileRevision
Get the last revision for the entity. If a revision has been added, this will be the newly added revision.
# getExternalId()
?string
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned

Methods 1

Take arguments. The API serialises only getters that need none.

# getRevisionById(int $id)
?FileRevision
Get the revision with the specified id

API & Jobs view

API & JobsEach property is a key in REST API responses and job payloads. Its name is the template getter without get, is or has. Methods that need arguments are not available here.

Properties 14

Read-only values on the record.

# path
string
Get the path for this file
# fullPath
string
Get the full path for this file. Alias for getPath.
# type
?string
Get the type of the file. Tries to determine the file type based on the active revision's virtual file type.
# previewImage
?Image
Get a preview image for the file. Returns null if no preview image exists.
# id
?int
# created
?DateTime
Get the date the record was created.
# modified
?DateTime
Get the last modification date for the record.
# filename
?Filename
# activeRevision
?FileRevision
# tags
?Collection<Tag>
# categories
?Collection<Category>
# revisions
?Collection<FileRevision>
# lastRevision
?FileRevision
Get the last revision for the entity. If a revision has been added, this will be the newly added revision.
# externalId
?string

Admin view

AdminAvailable in cdna-admin templates. Copy an admin template into your site repository to change how this record is edited.

Properties 18

Take no arguments.

# getPath()
string
Get the path for this file
# getFullPath()
string
Get the full path for this file. Alias for getPath.
# getType()
?string
Get the type of the file. Tries to determine the file type based on the active revision's virtual file type.
# getPreviewImage()
?Image
Get a preview image for the file. Returns null if no preview image exists.
# getId()
?int
# getCreated()
?DateTime
Get the date the record was created.
# getModified()
?DateTime
Get the last modification date for the record.
# getFilename()
?Filename
# getActiveRevision()
?FileRevision
# getTags()
?Collection<Tag>
# getCategories()
?Collection<Category>
# getRevisions()
?Collection<FileRevision>
# getLastRevision()
?FileRevision
Get the last revision for the entity. If a revision has been added, this will be the newly added revision.
# getExternalId()
?string
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned
# getDropzoneConfig() Admin only
array
Get the dropzone config for this file

Methods 1

Take arguments. The API serialises only getters that need none.

# getRevisionById(int $id)
?FileRevision
Get the revision with the specified id