File_Content trait provides functionality for managing files, file tags, and handling file uploads in a content management system.
Main Methods
files()
Sets up the configuration for managing files in the system.- Sets group name to “Files”
- Defines list and filter columns
- Prepares select data for file tags and colors
- Defines input fields (columns) for file entities
file_tags()
Manages the tags associated with files.- Sets group name to “Files”
- Defines list and filter columns for tags
- Sets up a simple structure for managing file tags
uploadFile()
Handles the upload of files (PDF, ZIP, VTT).POST data
- filename: Name of the file to be uploaded
- uploadpath: Path where the file should be uploaded
JSON response with upload status, file path, and filename
upload_image()
Handles the upload of image files.POST data
- filename: Name of the image file to be uploaded
- uploadpath: Path where the image should be uploaded
JSON response with upload status, file path, and filename
upload_pdf()
Handles the upload of PDF files (and some image formats).POST data
- filename: Name of the PDF file to be uploaded
- uploadpath: Path where the PDF should be uploaded
JSON response with upload status, file path, and filename
Configuration Properties
string
default:"Files"
Defines the group name for file-related entities.
string
default:""
Specifies the type of table (left empty in this trait).
Columns and Filters
listColumns (for files)
- title_en
- title
- file_tag
- ordering
- file_download
filterColumns (for files)
Same as listColumns, used for filtering in the UI.Input Fields (for files)
Key fields include:file
The actual file to be uploaded and managed.
text
English title of the file.
text
German title of the file.
text
Ordering of the file in lists.
ckeditor
German description of the file.
ckeditor
English description of the file.
image
An image or logo associated with the file.
select
Tag associated with the file.