Class MLA (Media Library Assistant) Modal contains enhancements for the WordPress 3.5+ Media Manager

package Media Library Assistant
since 1.20

 Methods

Initialization function, similar to __construct()

initialize() : void

since 1.20

Add the hidden form for the "Search Terms" popup modal window, but only once per page load

mla_add_terms_search_form() : void

since 1.90

Add the styles and scripts for the "Search Terms" popup modal window, but only once per page load

mla_add_terms_search_scripts() : void

since 1.90

Adjust ajax handler for Media Manager queries

mla_admin_init_action() : void

Replace 'query-attachments' with our own handler if the request is coming from the "Assistant" tab. Clean up the 'save-attachment-compat' values, removing the taxonomy updates MLS already handled.

since 1.20

Add/change custom fields to the Edit Media screen and Modal Window

mla_attachment_fields_to_edit_filter(array $form_fields, object $post) : array

Called from /wp-admin/includes/media.php, function get_compat_media_markup(); If "get_media_item_args"['in_modal'] => false ) its the Edit Media screen. If "get_media_item_args"['in_modal'] => true ) its the Media Manager Modal Window. For the Modal Window, $form_fields contains all the "compat-attachment-fields" including the taxonomies, which we want to enhance. Declared public because it is a filter.

since 1.71

Parameters

$form_fields

array

descriptors for the "compat-attachment-fields"

$post

object

the post to be edited

Returns

arrayupdated descriptors for the "compat-attachment-fields"

Echo the hidden form for the "Search Terms" popup modal window

mla_echo_terms_search_form() : void

since 1.90

Ajax handler for Media Manager "fill compat-attachment-fields" queries

mla_fill_compat_fields_action() : void

Prepares an array of (HTML) taxonomy meta boxes with attachment-specific values.

since 1.80

Saves the get_media_item_args array for the attachment_fields_to_edit filter

mla_get_media_item_args_filter(array $args) : array

Declared public because it is a filter.

since 1.71

Parameters

$args

array

arguments for the get_media_item function in /wp-admin/includes/media.php

Returns

arrayarguments for the get_media_item function (unchanged)

Adds settings values to be passed to the Media Manager in /wp-includes/js/media-views.js.

mla_media_view_settings_filter(array $settings, object $post) : array

Declared public because it is a filter.

since 1.20

Parameters

$settings

array

associative array with setting => value pairs

$post

object

|| NULL current post object, if available

Returns

arrayupdated $settings array

Adds string values to be passed to the Media Manager in /wp-includes/js/media-views.js.

mla_media_view_strings_filter(array $strings, object $post) : array

Declared public because it is a filter.

since 1.20

Parameters

$strings

array

associative array with string => value pairs

$post

object

|| NULL current post object, if available

Returns

arrayupdated $strings array

Prints the templates used in the MLA Media Manager enhancements.

mla_print_media_templates_action() : void

Declared public because it is an action.

since 1.20

Ajax handler for Media Manager "Query Attachments" queries

mla_query_attachments_action() : void

Adapted from wp_ajax_query_attachments in /wp-admin/includes/ajax-actions.php

since 1.20

Build the hidden form for the "Search Terms" popup modal window

mla_terms_search_form() : string

since 1.90

Returns

stringHTML
markup for hidden form

Ajax handler for Media Manager "update compat-attachment-fields" queries

mla_update_compat_fields_action() : void

Updates one (or more) supported taxonomy and returns updated checkbox or tag/term lists

since 1.80

Enqueues the mla-media-modal-scripts.js file, adding it to the Media Manager scripts.

mla_wp_enqueue_media_action() : void

Declared public because it is an action.

since 1.20

Display a monthly dropdown for filtering items

_months_dropdown(string $post_type) : array

Adapted from /wp-admin/includes/class-wp-list-table.php function months_dropdown()

since 1.20

Parameters

$post_type

string

post_type, e.g., 'attachment'

Returns

array( value => label ) pairs

Extract value and text elements from Dropdown HTML option tags

_terms_options(string $markup) : array

since 1.20

Parameters

$markup

string

HTML markup for taxonomy terms dropdown