\MatthiasWeb\RealMediaLibrary\attachmentStructure

This class handles all hooks and functions for the structure.

If something will print out, this is a facade-wrapper function for the class View (stored in private $view).

Summary

Methods
Properties
Constants
getPluginConstantPrefix()
__construct()
initialLoad()
resetData()
byId()
byAbsolutePath()
getRows()
getParsed()
getTree()
getPlainTree()
getCntAttachments()
getFolderCounts()
getCntRoot()
getView()
getData()
setData()
getInstance()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
fetch()
parse()
$blogs
$root
$rows
$parsed
$tree
$view
$hasInitialLoad
$data
N/A

Properties

$blogs

$blogs :

The structure should be accessible within one or more blogs. For those purposes use the wp standard method switch_to_blog();

This is an array of Structure objects.

Type

$root

$root :

The root folder ID. Can only be set by the constructor!

Type

$rows

$rows :

Array of database read rows

Type

$parsed

$parsed :

Type

$tree

$tree :

Type

$view

$view :

The view handler for this structure

Type

$hasInitialLoad

$hasInitialLoad :

Checks, if the folder tree is already loaded and do the initial load if needed by an function. So, RML can guarantee lazy loading.

Type

$data

$data :

Additional data passed to the structure.

Type

Methods

getPluginConstantPrefix()

getPluginConstantPrefix(): string

Get the prefix of this plugin so composer packages can dynamically build other constant values on it.

Returns

string

__construct()

__construct(integer  $root = null,array  $data = null)

Start reading a structure. If you pass a $root parameter the parameter is not automatically respected. You should then use your own implementation or filters to respect the root. Use this constructor to add your filters and respect your custom Structure class implementation.

Parameters

integer $root

The root folder defined for the structure

array $data

Custom data for the structure

initialLoad()

initialLoad()

Checks, if the SQL result is available and load it if not.

resetData()

resetData(integer  $root = null,boolean  $fetchData = true)

Resets the data of the structure.

Parameters

integer $root

The root folder

boolean $fetchData

Determine, if the data should be re-fetched

byId()

byId(integer  $id,boolean  $nullForRoot = true): \MatthiasWeb\RealMediaLibrary\api\IFolder|null

Get a folder by id.

Parameters

integer $id

The id of the folder

boolean $nullForRoot

If set to false and $id == -1 then the Root instance is returned

Returns

\MatthiasWeb\RealMediaLibrary\api\IFolder|null

byAbsolutePath()

byAbsolutePath(string  $path): \MatthiasWeb\RealMediaLibrary\api\IFolder|null

Get a folder by absolute path.

Parameters

string $path

The path

Returns

\MatthiasWeb\RealMediaLibrary\api\IFolder|null

getRows()

getRows(): array<mixed,object>

Get the SQL query result instead of IFolder objects.

Returns

array<mixed,object> —

The SQL result

getParsed()

getParsed(): array<mixed,\MatthiasWeb\RealMediaLibrary\api\IFolder>

Get all SQL query results as IFolder objects.

Returns

array<mixed,\MatthiasWeb\RealMediaLibrary\api\IFolder> —

The folders

getTree()

getTree(): array<mixed,\MatthiasWeb\RealMediaLibrary\api\IFolder>

Get all SQL query results placed to a tree. That means it is a "hierarchical" result where you work with ->getChildren(). The first level contains the top folders.

Returns

array<mixed,\MatthiasWeb\RealMediaLibrary\api\IFolder> —

The folders

getPlainTree()

getPlainTree(): array<mixed,object>

Get all SQL query results placed to a tree. It is fully resolved with all hierarchical plain objects of the folders expect the invisible nodes.

Returns

array<mixed,object>

getCntAttachments()

getCntAttachments(): integer

Get the attachment count for this structure.

Returns

integer —

Count

getFolderCounts()

getFolderCounts(): \MatthiasWeb\RealMediaLibrary\attachment\Array<string|\MatthiasWeb\RealMediaLibrary\attachment\int,int>

Get all folder counts.

Returns

\MatthiasWeb\RealMediaLibrary\attachment\Array

getCntRoot()

getCntRoot(): integer

Get the attachment count for the "Unorganized" folder for this structure.

Returns

integer —

Count

getView()

getView()

Get the view class instance.

getData()

getData(): array

Get the custom data.

Returns

array —

Data

setData()

setData(array  $data)

Set the custom data.

Parameters

array $data

The custom data

fetch()

fetch()

Fetching all available folders into an array.

parse()

parse()

This functions parses the read rows into folder objects.

It also handles the cnt cache for the attachments in this folder.