1

In my plugin, I would like to search a folder. However, I cannot find any information about the criteria for folders. Are there any documentation or something?

$n = Craft::$app->assets->findFolder(array(
    'name' => $folder,
    'parent' => $p_folder
));

My code is like this. Folder name is not unique, so I have to also use its parent. However, I do not know how to include parent folder in the criteria. "Parent" is not correct.

1

Check /vendor/craftcms/cms/src/models/FolderCriteria.php Class for reference. I guess most of craft's documentation lies in code.

Or you can visit https://docs.craftcms.com/api/v3/craft-models-foldercriteria.html which is the same thing.

check table "yourprefix_volumefolders" for data type of FolderCriteria.

| improve this answer | |
  • Thank you very much, this document is I have been looking for. – Kota.M Jul 18 '19 at 16:21

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.