SilverCart\Model\Product\File
DataObject to handle files added to a product or sth. else.
Provides additional (meta-)information about the file.
It's used to add PDF datasheets or other files.
- Author: Sebastian Diel <sdiel@pixeltricks.de>
- Copyright: 2017 pixeltricks GmbH
- License: see license file in modules root directory
Synopsis
class File
extends DataObject
{
- // members
- private static array $has_one = ;
- private static array $casting = ;
- private static array $has_many = ;
- private static string $table_name = 'SilvercartFile';
- // methods
- public string getTitle()
- public string getDescription()
- public string getFileIconURL()
- public DBHTMLText getFileIcon()
- public string singular_name()
- public string plural_name()
- public array fieldLabels()
- public array summaryFields()
- public FieldList getCMSFields()
- public bool isEmptyObject()
- public void onBeforeDelete()
- protected void onBeforeWrite()
- // Inherited methods from ExtensibleDataObject
- protected void beforeRequireDefaultRecords()
- protected void beforeUpdateCMSActions()
- protected void beforeUpdateFieldLabels()
- protected void beforeUpdateProvidePermissions()
- public array defaultFieldLabels()
- public static void reset_field_labels()
- protected array scaffoldFieldLabels()
Hierarchy
Members
private
- $casting
—
array
Castings - $has_many
—
array
1:n relationships. - $has_one
—
array
1:1 or 1:n relationships. - $table_name
—
string
DB table name
protected
- $defaultFieldLabels
—
array
Default field labels.
Methods
protected
- onBeforeWrite() — Sets the related file's title as title if no custom title is set before writing.
public
- fieldLabels() — Field labels for display in tables.
- getCMSFields() — customizes the backends fields, mainly for ModelAdmin
- getDescription() — getter for the Description, looks for set translation
- getFileIcon() — Returns a HTML snippet for the related Files icon.
- getFileIconURL() — Returns a HTML snippet for the related Files icon.
- getTitle() — getter for the Title, looks for set translation
- isEmptyObject() — Was the object just accidently written? object without attribute or file appended
- onBeforeDelete() — Deletes the related file before deleting this object.
- plural_name() — Returns the translated plural name.
- singular_name() — Returns the translated singular name.
- summaryFields() — Summaryfields for display in tables.
Inherited from SilverCart\ORM\ExtensibleDataObject
protected
- beforeRequireDefaultRecords() — Allows user code to hook into DataObject::requireDefaultRecords() prior to requireDefaultRecords being called on extensions.
- beforeUpdateCMSActions() — Allows user code to hook into DataObject::getCMSActions prior to updateCMSActions being called on extensions.
- beforeUpdateFieldLabels() — Allows user code to hook into DataObject::fieldLabels() prior to updateFieldLabels being called on extensions.
- beforeUpdateProvidePermissions() — Allows user code to hook into DataObject::updateProvidePermissions() prior to providePermissions being called on extensions.
- scaffoldFieldLabels() — Returns the default field labels for this DataObject.
public
- defaultFieldLabels() — Returns the default field labels.
- reset_field_labels() — Resets the field label cache.