IFolderActions
in
This interface provides elementary action methods for folder objects. All folder types (Folder, Collection, Gallery, ...) have implemented this interface.
Also the root ("Unorganized") is a folder and implements this interface.
Tags
Table of Contents
Methods
- insert() : true
- Insert an amount of post ID's (attachments) to this folder.
- orderSubfolders() : bool
- (Pro only) Start to order the given folder subfolders by a given order type.
- read() : array<string|int, int>
- Fetch all attachment ids currently in this folder. It uses the default WP_Query to fetch the ids. You can also use the WP_Query like: ```php $query = new \WP_Query([ 'post_status' => 'inherit', 'post_type' => 'attachment', 'rml_folder' => 4, // Can also be an array of integers 'rml_include_children' => false // (optional) Include files of subfolder, you have to use wp_rml_all_children_sql_supported(false, 'function') for checking support ]); ```
- reindexChildrens() : bool
- (Pro only) Reindex the children folders so the "ord" number is set right.
- relocate() : bool|array<string|int, string>
- Relocate a folder to a given place in the folder structure.
- resetSubfolderOrder() : bool
- (Pro only) Reset the subfolders order'.
- setName() : bool
- Renames a folder and then checks, if there is no duplicate folder in the parent folder.
- setParent() : bool
- Changes the parent folder of this folder.
- setRestrictions() : bool
- Set restrictions for this folder. Allowed restrictions for folders:
- setVisible() : mixed
- Sets the folders visibility to the user.
- updateThisAndChildrensAbsolutePath() : mixed
- Iterate all children of this folder recursively and update the absolute path. Use this function with caution because it can be time intensive.
Methods
insert()
Insert an amount of post ID's (attachments) to this folder.
public
insert(array<string|int, int> $ids[, bool $supress_validation = false ][, bool $isShortcut = false ]) : true
Parameters
- $ids : array<string|int, int>
-
Array of post ids
- $supress_validation : bool = false
-
Suppress the permission validation
- $isShortcut : bool = false
-
Determines, if the post's should be "copied" to the folder (no physical copy)
Tags
Return values
trueorderSubfolders()
(Pro only) Start to order the given folder subfolders by a given order type.
public
orderSubfolders(string $orderby[, bool $writeMetadata = true ]) : bool
Parameters
- $orderby : string
-
The order type key
- $writeMetadata : bool = true
Tags
Return values
boolread()
Fetch all attachment ids currently in this folder. It uses the default WP_Query to fetch the ids. You can also use the WP_Query like: ```php $query = new \WP_Query([ 'post_status' => 'inherit', 'post_type' => 'attachment', 'rml_folder' => 4, // Can also be an array of integers 'rml_include_children' => false // (optional) Include files of subfolder, you have to use wp_rml_all_children_sql_supported(false, 'function') for checking support ]); ```
public
read([string $order = null ][, string $orderby = null ]) : array<string|int, int>
Parameters
- $order : string = null
-
The order "ASC" or "DESC"
- $orderby : string = null
-
Use "rml" to get ids ordered by custom order
Return values
array<string|int, int> —Post ids
reindexChildrens()
(Pro only) Reindex the children folders so the "ord" number is set right.
public
reindexChildrens([bool $resetData = false ]) : bool
Parameters
- $resetData : bool = false
-
If true, the structure is reset
Tags
Return values
boolrelocate()
Relocate a folder to a given place in the folder structure.
public
relocate(int $parentId[, int $nextFolderId = false ]) : bool|array<string|int, string>
Parameters
- $parentId : int
-
The parent id
- $nextFolderId : int = false
-
The next folder id it should be prepend or false for the end
Tags
Return values
bool|array<string|int, string> —true or array with errors
resetSubfolderOrder()
(Pro only) Reset the subfolders order'.
public
resetSubfolderOrder() : bool
Tags
Return values
boolsetName()
Renames a folder and then checks, if there is no duplicate folder in the parent folder.
public
setName(string $name[, bool $supress_validation = false ]) : bool
Parameters
- $name : string
-
String New name of the folder
- $supress_validation : bool = false
-
Suppress the permission validation
Tags
Return values
boolsetParent()
Changes the parent folder of this folder.
public
setParent(int $id[, int $ord = -1 ][, bool $force = false ]) : bool
Parameters
- $id : int
-
The new parent (use -1 for root)
- $ord : int = -1
-
The order number
- $force : bool = false
-
If true no permission checks are executed
Tags
Return values
boolsetRestrictions()
Set restrictions for this folder. Allowed restrictions for folders:
public
setRestrictions([array<string|int, string> $restrictions = [] ]) : bool
- par Restrict to change the parent id
- rea Restrict to rearrange the hierarchical levels of all subfolders (it is downwards all subfolders!) and cannot be inherited
- cre Restrict to create new subfolders
- ins Restrict to insert/upload new attachments, automatically moved to root if upload
- ren Restrict to rename the folder
- del Restrict to delete the folder
- mov Restrict to move files outside the folder
You can append a ">" after each permission so it is inherited in each created subfolder: "cre>", "ins>", ...
Parameters
- $restrictions : array<string|int, string> = []
-
Array with restrictions
Return values
boolsetVisible()
Sets the folders visibility to the user.
public
setVisible(bool $visible) : mixed
Parameters
- $visible : bool
updateThisAndChildrensAbsolutePath()
Iterate all children of this folder recursively and update the absolute path. Use this function with caution because it can be time intensive.
public
updateThisAndChildrensAbsolutePath() : mixed