VolumeInterface

Type
Interface
Namespace
craft\base
Extends
craft\base\SavableComponentInterface
Implemented by
craft\base\FlysystemVolume, craft\base\Volume, craft\volumes\Local, craft\volumes\MissingVolume, craft\volumes\Temp
Since
3.0.0

VolumeInterface defines the common interface to be implemented by volume classes.

A class implementing this interface should also use craft\base\SavableComponentTrait and craft\base\VolumeTrait.

View source (opens new window)

# Public Methods

Method Description
afterDelete() Performs actions after a component is deleted.
afterSave() Performs actions after a component is saved.
beforeApplyDelete() Performs actions before a component delete is applied to the database.
beforeDelete() Performs actions before a component is deleted.
beforeSave() Performs actions before a component is saved.
copyFile() Copies a file.
createDir() Creates a directory.
createFileByStream() Creates a file.
deleteDir() Deletes a directory.
deleteFile() Deletes a file.
displayName() Returns the display name of this class.
fileExists() Returns whether a file exists.
folderExists() Returns whether a folder exists at the given path.
getFieldLayout() Returns the volume's field layout, or null if it doesn’t have one.
getFileList() List files.
getFileMetadata() Return the metadata about a file.
getFileStream() Gets a stream ready for reading by a file's URI.
getIsNew() Returns whether the component is new (unsaved).
getRootUrl() Returns the URL to the source, if it’s accessible via HTTP traffic.
getSettings() Returns an array of the component’s settings.
getSettingsHtml() Returns the component’s settings HTML.
isSelectable() Returns whether the component should be selectable in component Type selects.
renameDir() Renames a directory.
renameFile() Renames a file.
saveFileLocally() Save a file from the source's uriPath to a local target path.
settingsAttributes() Returns the list of settings attribute names.
updateFileByStream() Updates a file.

# copyFile()

Copies a file.

View source (opens new window)

Arguments

Throws

# createDir()

Creates a directory.

View source (opens new window)

Arguments

Throws

# createFileByStream()

Creates a file.

View source (opens new window)

Arguments

Throws

# deleteDir()

Deletes a directory.

View source (opens new window)

Arguments

Throws

# deleteFile()

Deletes a file.

View source (opens new window)

Arguments

Throws

# fileExists()

Returns whether a file exists.

View source (opens new window)

Arguments

Returns

boolean (opens new window)

# folderExists()

Returns whether a folder exists at the given path.

View source (opens new window)

Arguments

Returns

boolean (opens new window)

# getFieldLayout()

Since
3.5.0

Returns the volume's field layout, or null if it doesn’t have one.

View source (opens new window)

Returns

craft\models\FieldLayout, null (opens new window)

# getFileList()

List files.

View source (opens new window)

Arguments

Returns

array (opens new window)

# getFileMetadata()

Return the metadata about a file.

View source (opens new window)

Arguments

Returns

array (opens new window)

Throws

# getFileStream()

Gets a stream ready for reading by a file's URI.

View source (opens new window)

Arguments

Returns

resource (opens new window)

Throws

# getRootUrl()

Returns the URL to the source, if it’s accessible via HTTP traffic.

The URL should end in a /.

View source (opens new window)

Returns

string (opens new window), false (opens new window) – The root URL, or false if there isn’t one

# renameDir()

Renames a directory.

View source (opens new window)

Arguments

Throws

# renameFile()

Renames a file.

View source (opens new window)

Arguments

Throws

# saveFileLocally()

Save a file from the source's uriPath to a local target path.

View source (opens new window)

Arguments

Returns

integer (opens new window) – Amount of bytes copied

# updateFileByStream()

Updates a file.

View source (opens new window)

Arguments

Throws