pfeifferNet

Media_Selector
in package

WP media selector functionality.

Provides the media selector HTML partial. Enqueues required resources. Sets default JS variables.

Tags
since
5.8.0
since
5.11.0

Deprecated global singleton.

since
6.0.0

Fix text domain loading too early error.

used-by
Settings::__construct()
used-by
Tax_Meta::__construct()
used-by
Users::__construct()
used-by
Form_User_Account::__construct()

Table of Contents

Constants

IMAGE_SIZE  = 'medium_large'
The image size to display in the media selector container.
MEDIA_SELECTOR_CONTAINER  = 'media-selector.php'
Media selector partial filename.

Properties

$instances  : array<string|int, object>
The array of instances of this class and sub-classes.
$media  : Media
The instance of the Media class.
$media_selector_container  : string
The fully qualified path to the media selector partial.

Methods

get_instance()  : object
Creates and/or returns the instance of this class.
render()  : void
Render the media selector.
__construct()  : void
Initialise the class.
enqueue_assets()  : void
Enqueue the media selector resources.
get_inline_script()  : string
Get the inline javascript.

Constants

IMAGE_SIZE

The image size to display in the media selector container.

protected string IMAGE_SIZE = 'medium_large'

This must be one of the defined images sizes.

Tags
since
5.11.0

MEDIA_SELECTOR_CONTAINER

Media selector partial filename.

protected string MEDIA_SELECTOR_CONTAINER = 'media-selector.php'
Tags
since
1.0.0

Properties

$instances

The array of instances of this class and sub-classes.

protected static array<string|int, object> $instances = array()
Tags
since
5.11.0

$media_selector_container

The fully qualified path to the media selector partial.

protected string $media_selector_container = ''
Tags
since
5.3.0

Methods

get_instance()

Creates and/or returns the instance of this class.

public static get_instance() : object
Tags
since
5.11.0
Return values
object

The instance of this class.

render()

Render the media selector.

public render(array<string|int, mixed> $media_data) : void
Parameters
$media_data : array<string|int, mixed>

{ The array of data for the media selector. @type int $image_id The id of the selected image. @type string $alt Optional. The alt text of the selected image. @type string $field_id Optional. The attribute for the field id tag. @type string $field_name The input field name. @type string $title_remove Optional. The text for the replace button. @type string $title_replace Optional. The text for the replace button. @type string $title_select Optional. The text for the select button. @type string $url Optional. The url of the selected image. }

Tags
since
5.11.0
used-by
Settings::render_input_element()

enqueue_assets()

Enqueue the media selector resources.

protected enqueue_assets() : void
Tags
since
5.8.0
since
6.4.0

Check if script is already loaded.

get_inline_script()

Get the inline javascript.

protected get_inline_script() : string
Tags
since
5.8.0
since
6.4.0

Return the inline javascript.

Return values
string

The inline javascript.


        
On this page

Search results