Interface IFolder
This interface provides elementary getter and setter 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. Usually,
the root acts as "-1" but you should use the _wp_rml_root()
function to get the
root id. If this interface does not provide an expected method, yet, have a look at the
other API files. For example to create a folder use wp_rml_create()
.
Check if a variable is surely a IFolder interface object:
$folder = wp_rml_get_object_by_id(5); if (is_rml_folder($folder)) { // It is an interface implementation of IFolder }
Register own folder type:
You can create your own implementation of a folder type (Gallery, Collection, Root, ...) just have a look at the wp-content/plugins/real-media-library/inc/folder files. Here is a very basic example and the static methods you must create for your class:
/*
* ABSTRACT METHODS YOU MUST IMPLEMENT IN YOUR FOLDER CLASS!
*
/*
* Creates an instance for this folder type. This line is commented out,
* because PHP does not support abstract static functions. Please implement
* this function in your folder class.
*
* @param $rowData The row data from the database row
* @return Instance or null
*
/* public abstract static function instance($rowData); *
/*
* (optional) If you use wp_rml_register_creatable() with the parameter $onRegister = true then
* this function is called in your folder type class.
*
/* public abstract static function onRegister(); *
/*
* Creates a new instance for this folder type. This line is commented out,
* because PHP does not support abstract static functions. Please implement
* this function in your folder class.
*
* @param $rowData The row data from the database row
* @throws Exception when something went wrong by creating
* @return Instance or null
* @see Creatable::persist
*
/* public abstract static function create($rowData); *
Also have a look at the wp_rml_register_creatable()
function to register your class
(RML_TYPE_FOLDER is an unique defined integer for your folder type):
wp_rml_register_creatable(RML_NS . '\\folder\\Folder', RML_TYPE_FOLDER);
- MatthiasWeb\RealMediaLibrary\api\IFolder implements MatthiasWeb\RealMediaLibrary\api\IFolderActions, MatthiasWeb\RealMediaLibrary\api\IFolderContent
Direct known implementers
Indirect known implementers
MatthiasWeb\RealMediaLibrary\folder\Collection
,
MatthiasWeb\RealMediaLibrary\folder\Creatable
,
MatthiasWeb\RealMediaLibrary\folder\Folder
,
MatthiasWeb\RealMediaLibrary\folder\Gallery
,
MatthiasWeb\RealMediaLibrary\folder\Root
,
MatthiasWeb\RealMediaLibrary\order\Sortable
See:
wp_rml_root_childs()
See:
wp_rml_get_object_by_id()
See:
wp_rml_get_by_id()
See:
wp_rml_get_by_absolute_path()
See:
wp_rml_objects()
See:
is_rml_folder()
See:
MatthiasWeb\RealMediaLibrary\api\IFolderActions
Located at api/IFolder.interface.php
Methods summary
public
|
#
anyParentHas( string $column, mixed $value = null, string $valueFormat = "%s", boolean $includeSelf = false, integer $until = null )
Get all parents which meets a given column value or column value is not empty. |
public
|
#
anyParentHasMetadata( string $meta_key, mixed $meta_value = null, string $valueFormat = "%s", boolean $includeSelf = false, integer $until = null )
Get all parents which meets a given meta key value or meta key value is not empty. |
public
|
#
anyChildrenHas( string $column, mixed $value = null, string $valueFormat = "%s", boolean $includeSelf = false )
Get all children which meets a given column value or column value is not empty. |
public
|
#
anyChildrenHasMetadata( string $meta_key, mixed $meta_value = null, string $valueFormat = "%s", boolean $includeSelf = false )
Get all chilren which meets a given meta key value or meta key value is not empty. |
public
|
#
hasChildren( string $name, boolean $returnObject = false )
Checks if this folder has a children with a given name. |
public
|
|
public
boolean|int[]
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
getAbsolutePath( boolean $force = false, $fromSetName = false )
Creates a absolute path. If the absolute path is empty or forced to, it will be updated in the database, too. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
getTypeName( string $default = null )
Get the type name for this folder. For example: Folder, Collection, Gallery, Unorganized. |
public
|
|
public
|
|
public
|
|
public
|
Methods inherited from MatthiasWeb\RealMediaLibrary\api\IFolderActions
insert()
,
read()
,
reindexChildrens()
,
relocate()
,
setName()
,
setParent()
,
setRestrictions()
,
updateThisAndChildrensAbsolutePath()
Methods inherited from MatthiasWeb\RealMediaLibrary\api\IFolderContent
contentDeleteOrder()
,
contentEnableOrder()
,
contentIndex()
,
contentOrder()
,
contentReindex()
,
contentRestoreOldCustomNr()
,
getAttachmentNextTo()
,
getContentAggregationNr()
,
getContentCustomOrder()
,
getContentNrOf()
,
getContentOldCustomNrCount()
,
getContentOrderNumbers()
,
isContentCustomOrderAllowed()