Class craft\services\Volumes
- Inheritance
- craft\services\Volumes » yii\base\Component » yii\base\BaseObject
- Implements
- yii\base\Configurable
- Available since version
- 3.0
- Source Code
- https://github.com/craftcms/cms/blob/master/src/services/Volumes.php
Class AssetVolumesService
See also http://craftcms.com.
Method | Description | Defined By |
---|---|---|
__call() |
Calls the named method which is not a class method. | yii\base\BaseObject |
__clone() |
This method is called after the object is created by cloning an existing one. | yii\base\Component |
__construct() |
Constructor. | yii\base\BaseObject |
__get() |
Returns the value of an object property. | yii\base\BaseObject |
__isset() |
Checks if a property is set, i.e. defined and not null. | yii\base\BaseObject |
__set() |
Sets value of an object property. | yii\base\BaseObject |
__unset() |
Sets an object property to null. | yii\base\BaseObject |
attachBehavior() |
Attaches a behavior to this component. | yii\base\Component |
attachBehaviors() |
Attaches a list of behaviors to the component. | yii\base\Component |
behaviors() |
Returns a list of behaviors that this component should behave as. | yii\base\Component |
canGetProperty() |
Returns a value indicating whether a property can be read. | yii\base\BaseObject |
canSetProperty() |
Returns a value indicating whether a property can be set. | yii\base\BaseObject |
className() |
Returns the fully qualified name of this class. | yii\base\BaseObject |
createVolume() |
Creates an asset volume with a given config. | craft\services\Volumes |
deleteVolume() |
Deletes an asset volume. | craft\services\Volumes |
deleteVolumeById() |
Deletes an asset volume by its ID. | craft\services\Volumes |
detachBehavior() |
Detaches a behavior from the component. | yii\base\Component |
detachBehaviors() |
Detaches all behaviors from the component. | yii\base\Component |
ensureBehaviors() |
Makes sure that the behaviors declared in behaviors() are attached to this component. | yii\base\Component |
ensureTopFolder() |
Ensures a top level folder exists that matches the model. | craft\services\Volumes |
getAllVolumeIds() |
Returns all of the volume IDs. | craft\services\Volumes |
getAllVolumeTypes() |
Returns all registered volume types. | craft\services\Volumes |
getAllVolumes() |
Returns all volumes. | craft\services\Volumes |
getBehavior() |
Returns the named behavior object. | yii\base\Component |
getBehaviors() |
Returns all behaviors attached to this component. | yii\base\Component |
getPublicVolumeIds() |
Returns all volume IDs that have public URLs. | craft\services\Volumes |
getPublicVolumes() |
Returns all volumes that have public URLs. | craft\services\Volumes |
getTotalViewableVolumes() |
Returns the total number of volumes that are viewable by the current user. | craft\services\Volumes |
getTotalVolumes() |
Returns the total number of volumes. | craft\services\Volumes |
getViewableVolumeIds() |
Returns all volume IDs that are viewable by the current user. | craft\services\Volumes |
getViewableVolumes() |
Returns all volumes that are viewable by the current user. | craft\services\Volumes |
getVolumeByHandle() |
Returns a volumn by its handle. | craft\services\Volumes |
getVolumeById() |
Returns a volume by its ID. | craft\services\Volumes |
getVolumeOverrides() |
Returns any custom volume config values. | craft\services\Volumes |
hasEventHandlers() |
Returns a value indicating whether there is any handler attached to the named event. | yii\base\Component |
hasMethod() |
Returns a value indicating whether a method is defined. | yii\base\BaseObject |
hasProperty() |
Returns a value indicating whether a property is defined. | yii\base\BaseObject |
init() |
Initializes the object. | yii\base\BaseObject |
off() |
Detaches an existing event handler from this component. | yii\base\Component |
on() |
Attaches an event handler to an event. | yii\base\Component |
reorderVolumes() |
Reorders asset volumes. | craft\services\Volumes |
saveVolume() |
Saves an asset volume. | craft\services\Volumes |
trigger() |
Triggers an event. | yii\base\Component |
Event | Type | Description | Defined By |
---|---|---|---|
EVENT_AFTER_DELETE_VOLUME |
craft\events\VolumeEvent | The event that is triggered after a Asset volume is deleted. | craft\services\Volumes |
EVENT_AFTER_SAVE_VOLUME |
craft\events\VolumeEvent | The event that is triggered after an Asset volume is saved. | craft\services\Volumes |
EVENT_BEFORE_DELETE_VOLUME |
craft\events\VolumeEvent | The event that is triggered before an Asset volume is deleted. | craft\services\Volumes |
EVENT_BEFORE_SAVE_VOLUME |
craft\events\VolumeEvent | The event that is triggered before an Asset volume is saved. | craft\services\Volumes |
EVENT_REGISTER_VOLUME_TYPES |
craft\events\RegisterComponentTypesEvent | The event that is triggered when registering volume types. | craft\services\Volumes |
Method Details
createVolume()
public method
#
Creates an asset volume with a given config.
public craft\base\VolumeInterface createVolume ( $config )
$config |
mixed | The asset volume’s class name, or its config, with a type value and optionally a settings value
|
return | craft\base\VolumeInterface | The asset volume |
---|
deleteVolume()
public method
#
Deletes an asset volume.
public boolean deleteVolume ( craft\base\VolumeInterface $volume )
$volume |
craft\base\VolumeInterface | The volume to delete |
throws | Throwable |
---|
deleteVolumeById()
public method
#
Deletes an asset volume by its ID.
public boolean deleteVolumeById ( \craft\services\int $volumeId )
$volumeId |
integer | |
throws | Throwable |
---|
ensureTopFolder()
public method
#
Ensures a top level folder exists that matches the model.
public integer ensureTopFolder ( craft\base\VolumeInterface $volume )
$volume |
craft\base\VolumeInterface |
getAllVolumeIds()
public method
#
Returns all of the volume IDs.
public array getAllVolumeIds ( )
getAllVolumeTypes()
public method
#
Returns all registered volume types.
public string[] getAllVolumeTypes ( )
getAllVolumes()
public method
#
Returns all volumes.
public craft\base\VolumeInterface[] getAllVolumes ( )
getPublicVolumeIds()
public method
#
Returns all volume IDs that have public URLs.
public integer[] getPublicVolumeIds ( )
getPublicVolumes()
public method
#
Returns all volumes that have public URLs.
public craft\base\VolumeInterface[] getPublicVolumes ( )
getTotalViewableVolumes()
public method
#
Returns the total number of volumes that are viewable by the current user.
public integer getTotalViewableVolumes ( )
getTotalVolumes()
public method
#
Returns the total number of volumes.
public integer getTotalVolumes ( )
getViewableVolumeIds()
public method
#
Returns all volume IDs that are viewable by the current user.
public array getViewableVolumeIds ( )
getViewableVolumes()
public method
#
Returns all volumes that are viewable by the current user.
public craft\base\VolumeInterface[] getViewableVolumes ( )
getVolumeByHandle()
public method
#
Returns a volumn by its handle.
public craft\base\VolumeInterface, null getVolumeByHandle ( \craft\services\string $handle )
$handle |
string |
getVolumeById()
public method
#
Returns a volume by its ID.
public craft\base\VolumeInterface, null getVolumeById ( \craft\services\int $volumeId )
$volumeId |
integer |
getVolumeOverrides()
public method
#
Returns any custom volume config values.
public array, null getVolumeOverrides ( \craft\services\string $handle )
$handle |
string | The volume handle |
reorderVolumes()
public method
#
Reorders asset volumes.
public boolean reorderVolumes ( array $volumeIds )
$volumeIds |
array | |
throws | Throwable |
---|
saveVolume()
public method
#
Saves an asset volume.
public boolean saveVolume ( craft\base\VolumeInterface $volume, \craft\services\bool $runValidation = true )
$volume |
craft\base\VolumeInterface | The volume to be saved. |
$runValidation |
boolean | Whether the volume should be validated |
return | boolean | Whether the field was saved successfully |
---|---|---|
throws | Throwable |
Event Details
EVENT_AFTER_DELETE_VOLUME
event of type craft\events\VolumeEvent
#
The event that is triggered after a Asset volume is deleted.
EVENT_AFTER_SAVE_VOLUME
event of type craft\events\VolumeEvent
#
The event that is triggered after an Asset volume is saved.
EVENT_BEFORE_DELETE_VOLUME
event of type craft\events\VolumeEvent
#
The event that is triggered before an Asset volume is deleted.
EVENT_BEFORE_SAVE_VOLUME
event of type craft\events\VolumeEvent
#
The event that is triggered before an Asset volume is saved.
EVENT_REGISTER_VOLUME_TYPES
event of type craft\events\RegisterComponentTypesEvent
#
The event that is triggered when registering volume types.