The 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.
Key Actions
  • 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.
Key Actions
  • 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).
Parameters
POST data
  • filename: Name of the file to be uploaded
  • uploadpath: Path where the file should be uploaded
Returns
JSON response with upload status, file path, and filename

upload_image()

Handles the upload of image files.
Parameters
POST data
  • filename: Name of the image file to be uploaded
  • uploadpath: Path where the image should be uploaded
Returns
JSON response with upload status, file path, and filename

upload_pdf()

Handles the upload of PDF files (and some image formats).
Parameters
POST data
  • filename: Name of the PDF file to be uploaded
  • uploadpath: Path where the PDF should be uploaded
Returns
JSON response with upload status, file path, and filename

Configuration Properties

groupName
string
default:"Files"
Defines the group name for file-related entities.
typeOfTable
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_download
file
The actual file to be uploaded and managed.
title_en
text
English title of the file.
title
text
German title of the file.
ordering
text
Ordering of the file in lists.
description
ckeditor
German description of the file.
description_en
ckeditor
English description of the file.
image
image
An image or logo associated with the file.
file_tag
select
Tag associated with the file.