Interface IFolderActions
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.
Methods summary
public
|
#
read( string $order = null, string $orderby = null )
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:
$query = new \WP_Query(array(
'post_status' => 'inherit',
'post_type' => 'attachment',
'rml_folder' => 4
));
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:
$query = new \WP_Query(array(
'post_status' => 'inherit',
'post_type' => 'attachment',
'rml_folder' => 4
));
Parameters
- $order
- The order "ASC" or "DESC"
- $orderby
- Use "rml" to get ids ordered by custom order
Returns
int[] Post ids
|
public
|
#
relocate( integer $parentId, integer $nextFolderId = false )
Relocate a folder to a given place in the folder structure.
Relocate a folder to a given place in the folder structure.
Parameters
- $parentId
- The parent id
- $nextFolderId
- The next folder id it should be prepend or false for the end
Throws
Exception
Returns
boolean|string[] true or array with errors
|
public
|
#
reindexChildrens( boolean $resetData = false )
Reindex the children folders so the "ord" number is setted right.
Reindex the children folders so the "ord" number is setted right.
Parameters
- $resetData
- If true, the structure is resetted
See
IFolder::getOrder
|
public
true
|
#
insert( int[] $ids, boolean $supress_validation = false, boolean $isShortcut = false )
Insert an amount of post ID's (attachments) to this folder.
Insert an amount of post ID's (attachments) to this folder.
Parameters
- $ids
- Array of post ids
- $supress_validation
- Supress the permission validation
- $isShortcut
- Determines, if the post's should be "copied" to the folder (no physical copy)
Returns
true
Throws
Exception
See
|
public
|
#
updateThisAndChildrensAbsolutePath( )
Iterate all chrildren of this folder recursivly and
update the absolute pathes. Use this function with caution because it can be
time intensive.
Iterate all chrildren of this folder recursivly and
update the absolute pathes. Use this function with caution because it can be
time intensive.
|
public
|
#
setRestrictions( string[] $restrictions = array() )
Set restrictions for this folder. Allowed restrictions for folders:
Set restrictions for this folder. Allowed restrictions for folders:
- par Restrict to change the parent id
- rea Restrict to rearrange the hierarchical levels of all subfolders (it is downwards all subfolders!) and can not 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 with restrictions
Returns
boolean
|
public
|
#
setParent( integer $id, integer $ord = -1, boolean $force = false )
Changes the parent folder of this folder.
Changes the parent folder of this folder.
Parameters
- $id
- The new parent (use -1 for root)
- $ord
- The order number
- $force
- If true no permission checks are executed
Throws
Exception
Returns
boolean
|
public
|
#
setName( string $name, boolean $supress_validation = false )
Renames a folder and then checks, if there is no duplicate folder in the
parent folder.
Renames a folder and then checks, if there is no duplicate folder in the
parent folder.
Parameters
- $name
- String New name of the folder
- $supress_validation
- Supress the permission validation
Throws
Exception
Returns
boolean
|