\MatthiasWeb\RealMediaLibrary\metadataCoverImage

Implements a cover image for root folder, collections, galleries and normal folders.

Summary

Methods
Properties
Constants
getPluginConstantPrefix()
__construct()
ajax_get_attachment_by_url()
delete_attachment()
scripts()
content()
save()
isDisabled()
getAttachmentID()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

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()

C'tor.

ajax_get_attachment_by_url()

ajax_get_attachment_by_url()

Get attachment id by URL via admin-ajax.php.

delete_attachment()

delete_attachment(integer  $postid)

An attachment gets deleted, so delete meta, too.

Parameters

integer $postid

scripts()

scripts(\MatthiasWeb\RealMediaLibrary\Assets  $assets)

Enqueue scripts.

Parameters

\MatthiasWeb\RealMediaLibrary\Assets $assets

The assets instance so you can enqueue library scripts

content()

content(string  $content,\MatthiasWeb\RealMediaLibrary\api\IFolder  $folder): string

Generate content for meta box.

Note: If you want to use a more complex content in a meta table use something like this:

<tr>
 <th scope="row">Medium size</th>
 <td><fieldset>
     <legend class="screen-reader-text"><span>Medium size</span></legend>
     <label for="medium_size_w">Max Width</label>
     <input name="medium_size_w" type="number" step="1" min="0" id="medium_size_w" value="300" class="small-text">
     <label for="medium_size_h">Max Height</label>
     <input name="medium_size_h" type="number" step="1" min="0" id="medium_size_h" value="300" class="small-text">
 </fieldset></td>
</tr>

If you want to "group" your meta boxes you can use this code to create a empty space: <tr class="rml-meta-margin"></tr>

Parameters

string $content

the HTML formatted string for the dialog

\MatthiasWeb\RealMediaLibrary\api\IFolder $folder

The folder object

Returns

string

save()

save(array<mixed,string>  $response,\MatthiasWeb\RealMediaLibrary\api\IFolder  $folder,\WP_REST_Request  $request): array<mixed,string>

Save content in meta box.

$response["errors"][] = "Your error";
$response["data"]["myData"] = "Test";

Since v.4.0.8 the minimum PHP version is 4.0.8 and you can use traits in your meta implementation: metadata\CommonTrait, metadata\CommonFolderTrait or usersettings\CommonUserSettingsTrait.

Parameters

array<mixed,string> $response

Array of errors and successful data.

\MatthiasWeb\RealMediaLibrary\api\IFolder $folder

The folder object

\WP_REST_Request $request

The server request

Returns

array<mixed,string>

isDisabled()

isDisabled()

WP Media Picker is not compatible with Thrive Quiz Builder so disable this meta in this view.

getAttachmentID()

getAttachmentID(integer  $fid): integer

Get attachment ID if cover image is set.

Parameters

integer $fid

Returns

integer