Documentation

meta.php

Table of Contents

Functions

get_media_folder_meta()  : array<string|int, mixed>|mixed
Retrieve folder meta field for a folder.
add_media_folder_meta()  : int|false
Add meta data field to a folder.
update_media_folder_meta()  : int|bool
Update folder meta field based on folder ID.
delete_media_folder_meta()  : bool
Remove metadata matching criteria from a folder.
delete_media_folder_meta_by_key()  : bool
Delete everything from folder meta matching meta key.
truncate_media_folder_meta()  : int
Remove all meta of a folder. Use this with caution!!
add_rml_user_settings_box()  : bool
Add a visible content to the general user settings dialog.
add_rml_meta_box()  : bool
Add a visible content to the folder details dialog.

Functions

get_media_folder_meta()

Retrieve folder meta field for a folder.

get_media_folder_meta(int $folder_id[, string $key = '' ][, bool $single = false ]) : array<string|int, mixed>|mixed
Parameters
$folder_id : int

Folder ID.

$key : string = ''

The meta key to retrieve. By default, returns data for all keys.

$single : bool = false

Whether to return a single value. Default false.

Return values
array<string|int, mixed>|mixed

Will be an array if $single is false. Will be value of meta data field if $single is true.

add_media_folder_meta()

Add meta data field to a folder.

add_media_folder_meta(int $folder_id, string $meta_key, mixed $meta_value[, bool $unique = false ]) : int|false

Folder meta data is called "Custom Fields" on the Administration Screen.

Parameters
$folder_id : int

Folder ID.

$meta_key : string

Metadata name.

$meta_value : mixed

Metadata value. Must be serializable if non-scalar.

$unique : bool = false

Whether the same key should not be added.

Return values
int|false

update_media_folder_meta()

Update folder meta field based on folder ID.

update_media_folder_meta(int $folder_id, string $meta_key, mixed $meta_value[, mixed $prev_value = '' ]) : int|bool

Use the $prev_value parameter to differentiate between meta fields with the same key and folder ID.

If the meta field for the folder does not exist, it will be added.

Parameters
$folder_id : int

Folder ID.

$meta_key : string

Metadata key.

$meta_value : mixed

Metadata value. Must be serializable if non-scalar.

$prev_value : mixed = ''

Previous value to check before removing.

Return values
int|bool

delete_media_folder_meta()

Remove metadata matching criteria from a folder.

delete_media_folder_meta(int $folder_id, string $meta_key[, mixed $meta_value = '' ]) : bool

You can match based on the key, or key and value. Removing based on key and value, will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed.

Parameters
$folder_id : int

Folder ID.

$meta_key : string

Metadata name.

$meta_value : mixed = ''

Metadata value. Must be serializable if non-scalar.

Return values
bool

True on success, false on failure.

delete_media_folder_meta_by_key()

Delete everything from folder meta matching meta key.

delete_media_folder_meta_by_key(string $folder_meta_key) : bool
Parameters
$folder_meta_key : string

Key to search for when deleting.

Return values
bool

Whether the post meta key was deleted from the database.

truncate_media_folder_meta()

Remove all meta of a folder. Use this with caution!!

truncate_media_folder_meta(int $folder_id) : int
Parameters
$folder_id : int

Folder ID

Return values
int

add_rml_user_settings_box()

Add a visible content to the general user settings dialog.

add_rml_user_settings_box(string $name, IUserSettings $obj[, bool $deprecated = false ][, int $priority = 10 ][, string $contentGroup = '' ]) : bool

Example: Adding a new tab "Physical" group to user settings dialog (or RML/Folder/Meta/Groups for folder details)

add_filter("RML/User/Settings/Groups", function($groups) {
 $groups["physical"] = __("Physical");
 return $groups;
});
Parameters
$name : string

Unique name for this meta box

$obj : IUserSettings

The object which implements IUserSettings

$deprecated : bool = false

boolean Load the resources if exists (since 4.3.0 deprecated, scripts method is always called)

$priority : int = 10

Priority for actions and filters

$contentGroup : string = ''

The tab group for the meta settings, see example for adding a new group

Return values
bool

add_rml_meta_box()

Add a visible content to the folder details dialog.

add_rml_meta_box(string $name, IMetadata $obj[, bool $hasScripts = false ][, int $priority = 10 ][, string $contentGroup = '' ]) : bool

Example: Adding a new tab "Physical" group to meta dialog (or RML/User/Settings/Groups for user settings)

add_filter("RML/Folder/Meta/Groups", function($groups) {
 $groups["physical"] = __("Physical");
 return $groups;
});
Parameters
$name : string

Unique name for this meta box

$obj : IMetadata

The object which implements IMetadata

$hasScripts : bool = false

boolean Load the resources if exists

$priority : int = 10

Priority for actions and filters

$contentGroup : string = ''

The tab group for the meta settings, see example for adding a new group

Return values
bool

        
On this page

Search results