Fs ​
- Type
- Class
- Namespace
- craft\services
- Inherits
- craft\services\Fs » yii\base\Component » yii\base\BaseObject
- Implements
- yii\base\Configurable
- Since
- 4.0.0
Filesystems service.
An instance of the service is available via Craft::$app->getFs().
Public Properties ​
| Property | Description |
|---|---|
| allFilesystemTypes | string[] – All registered filesystem types |
| allFilesystems | craft\base\FsInterface[] – All filesystems |
| behaviors | yii\base\Behavior – List of behaviors attached to this component. |
allFilesystemTypes ​
- Type
- string[]
- Default value
null
All registered filesystem types
allFilesystems ​
- Type
- craft\base\FsInterface[]
- Default value
null
All filesystems
Public Methods ​
| Method | Description |
|---|---|
| __call() | Calls the named method which is not a class method. |
| __clone() | This method is called after the object is created by cloning an existing one. |
| __construct() | Constructor. |
| __get() | Returns the value of a component property. |
| __isset() | Checks if a property is set, i.e. defined and not null. |
| __serialize() | Serializer |
| __set() | Sets the value of a component property. |
| __unset() | Sets a component property to be null. |
| attachBehavior() | Attaches a behavior to this component. |
| attachBehaviors() | Attaches a list of behaviors to the component. |
| behaviors() | Returns a list of behaviors that this component should behave as. |
| canGetProperty() | Returns a value indicating whether a property can be read. |
| canSetProperty() | Returns a value indicating whether a property can be set. |
| className() | Returns the fully qualified name of this class. |
| createFilesystem() | Creates a filesystem from a given config. |
| createFilesystemConfig() | Returns the config for the given filesystem. |
| detachBehavior() | Detaches a behavior from the component. |
| detachBehaviors() | Detaches all behaviors from the component. |
| ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. |
| getAllFilesystemTypes() | Returns all registered filesystem types. |
| getAllFilesystems() | Returns all filesystems. |
| getBehavior() | Returns the named behavior object. |
| getBehaviors() | Returns all behaviors attached to this component. |
| getFilesystemByHandle() | Returns a filesystem by its handle. |
| hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. |
| hasMethod() | Returns a value indicating whether a method is defined. |
| hasProperty() | Returns a value indicating whether a property is defined for this component. |
| init() | Initializes the object. |
| off() | Detaches an existing event handler from this component. |
| on() | Attaches an event handler to an event. |
| removeFilesystem() | Removes a filesystem. |
| saveFilesystem() | Creates or updates a filesystem. |
| trigger() | Triggers an event. |
__serialize() ​
Serializer
createFilesystem() ​
Creates a filesystem from a given config.
Arguments ​
$config(class-string<\craft\services\T>, array) – The filesystem’s class name, or its config, with atypevalue and optionally asettingsvalue
Returns ​
\craft\services\T – The filesystem
createFilesystemConfig() ​
Returns the config for the given filesystem.
Arguments ​
$fs(craft\base\FsInterface)
Returns ​
getAllFilesystemTypes() ​
Returns all registered filesystem types.
Returns ​
string[]
getAllFilesystems() ​
Returns all filesystems.
Returns ​
getFilesystemByHandle() ​
Returns a filesystem by its handle.
Arguments ​
$handle(string)
Returns ​
removeFilesystem() ​
Removes a filesystem.
Arguments ​
$fs(craft\base\FsInterface) – The filesystem to remove
Returns ​
Throws ​
saveFilesystem() ​
Creates or updates a filesystem.
Arguments ​
$fs(craft\base\FsInterface) – The filesystem to be saved.$runValidation(boolean) – Whether the filesystem should be validated
Returns ​
boolean – Whether the filesystem was saved successfully
Throws ​
Events ​
EVENT_REGISTER_FILESYSTEM_TYPES ​
The event that is triggered when registering filesystem types.
EVENT_RENAME_FILESYSTEM ​
The event that is triggered after a filesystem is renamed.