2

How can I get the details of an asset volume in Craft 3, if I only know the handle?

I found the Volumes and the Assets service, but I believe none of them provides a method for that purpose. The only thing I found was this:

Craft::$app->getVolumes()->getVolumeById($id)

But how do I get the id? I do not want to iterate over getAllVolumes()...

3

As of this commit, there is a Craft::$app->getVolumes()->getVolumeByHandle($handle) method you can call.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.