Class MLA (Media Library Assistant) Polylang provides admin mode support for the Polylang Multilingual plugin
| package |
Media Library Assistant |
|---|---|
| since | 2.11 |
_add_relevant_term( $term, $translations = NULL)
| since | 2.11 |
|---|---|
| uses | |
_apply_synch_input(string $language) : array
Assumes the "current post" in $existing_terms is the source and $existing_terms contains the target translation
| since | 2.11 |
|---|---|
| uses |
stringthe target translation code
array$tax_inputs for Term Synchronization
_apply_tax_input(integer $post_id, string $post_language = NULL) : array
| since | 2.11 |
|---|---|
| uses |
integerID of the post to be updated
stringexplicit language_code; optional
arraylanguage-specific $tax_inputs
_apply_term_synchronization(integer $post_id) : array
| since | 2.15 |
|---|---|
| uses |
integerthe item we're synchronizing to
array$tax_inputs for Term Synchronization
_build_existing_terms(integer $post_id)
Takes each translatable taxonomy and builds an array of language-specific term_id to term_id/term_name mappings for terms already assigned to the item translation.
| since | 2.11 |
|---|---|
| uses | |
integerID of the current post
_build_tax_input(integer $post_id, array $tax_inputs = NULL, array $tax_actions = NULL, boolean $add_new_names = false)
Takes each term from the $tax_inputs parameter and builds an array of language-specific term_id to term_id/term_name mappings for all languages.
| since | 2.11 |
|---|---|
| uses | |
integerID of the current post
array'tax_input' request parameter
array'tax_action' request parameter
booleanAdd term and translations for new names
_create_relevant_term(string $name, string $taxonomy, string $language)
| since | 2.40 |
|---|---|
stringnew term name
stringslug
stringcode/slug
_create_relevant_translation(string $relevant_term, string $language)
| since | 2.40 |
|---|---|
stringcurrent term
stringcode/slug
_get_relevant_term(string $field, mixed $value, string $taxonomy, string $language = NULL, boolean $test_only = false)
| since | 2.11 |
|---|---|
| uses | |
stringto search in; 'id', 'name', or 'term_taxonomy_id'
mixedto search for; integer, string or integer
stringto search in; slug
stringcode; string; optional
booleanfalse (default) to add missing term, true to leave term out
_get_translation( $post_id, $new_language) : integer
| since | 2.11 |
|---|
integerID of the corresponding item in the desired language
_reset_language_settings() : array
| since | 2.11 |
|---|---|
arrayMessage(s) reflecting the results of the operation
_save_language_settings() : array
| since | 2.11 |
|---|---|
| uses | |
arrayMessage(s) reflecting the results of the operation
_update_existing_terms(integer $post_id) : array
Takes each translatable taxonomy and rebuilds the array of language-specific term_id to term_id/term_name mappings for the "current translation" represented by the $post_id.
| since | 2.11 |
|---|---|
| uses |
integerID of the current post
array( taxonomy => term assignments ) before the update
admin_enqueue_scripts( $page_hook) : void
| since | 2.11 |
|---|
admin_init() : void
| since | 2.11 |
|---|---|
initialize() : void
| since | 2.11 |
|---|---|
mla_begin_mapping( $source, $post_id = NULL)
| since | 2.20 |
|---|---|
mla_end_mapping() : void
| since | 2.20 |
|---|---|
mla_list_table_add_pll_styles() : void
| since | 2.11 |
|---|---|
mla_list_table_build_inline_data(string $inline_data, object $item) : string
Adds item-specific translations data for the JS quick and bulk edit functions.
| since | 2.11 |
|---|
stringThe HTML markup for inline data.
objectThe current Media Library item.
stringupdated HTML markup for inline data.
mla_list_table_build_rollover_actions(array $actions, object $item, string $column) : array
Adds "Quick Translate" to the list of item-level "Rollover" actions.
| since | 2.11 |
|---|
arrayThe list of item "Rollover" actions.
objectThe current Media Library item.
stringThe List Table column slug.
arrayupdated "Rollover" actions.
mla_list_table_bulk_action(array $item_content, string $bulk_action, integer $post_id) : object
| since | 2.11 |
|---|
arrayNULL, to indicate no handler.
stringthe requested action.
integerthe affected attachment.
objectupdated $item_content. NULL if no handler, otherwise ( 'message' => error or status message(s), 'body' => '', 'prevent_default' => true to bypass the MLA handler )
mla_list_table_bulk_action_initial_request(array $request, string $bulk_action, array $custom_field_map) : array
| since | 2.11 |
|---|
arraybulk action request parameters, including ['mla_bulk_action_do_cleanup'].
stringthe requested action.
array[ slug => field_name ]
arrayupdated bulk action request parameters
mla_list_table_bulk_action_item_request(array $request, string $bulk_action, integer $post_id, array $custom_field_map) : array
| since | 2.11 |
|---|
arraybulk action request parameters, including ['mla_bulk_action_do_cleanup'].
stringthe requested action.
integerthe affected attachment.
array[ slug => field_name ]
arrayupdated bulk action request parameters
mla_list_table_column_default( $content, $item, $column_name) : string
Fills in the Language columns with the item's translation status values.
| since | 2.11 |
|---|
stringText or HTML to be placed inside the column
mla_list_table_custom_bulk_action(array $item_content, string $bulk_action, integer $post_id) : object
| since | 2.11 |
|---|
arrayNULL, to indicate no handler.
stringthe requested action.
integerthe affected attachment.
objectupdated $item_content. NULL if no handler, otherwise ( 'message' => error or status message(s), 'body' => '' )
mla_list_table_get_bulk_actions(array $actions) : array
Adds the "Translate" action to the Bulk Actions list.
| since | 2.11 |
|---|
arrayAn array of bulk actions. Format: 'slug' => 'Label'
arrayupdated array of actions.
mla_list_table_get_columns(array $columns) : array
Inserts the language columns just after the item thumbnail column
| since | 2.11 |
|---|
arrayAn array of columns. format: column_slug => Column Label
arrayupdated array of columns.
mla_list_table_inline_action(array $item_content, integer $post_id) : object
| since | 2.11 |
|---|
arrayNULL, to indicate no handler.
integerthe affected attachment.
objectupdated $item_content. NULL if no handler, otherwise ( 'message' => error or status message(s), 'body' => '', 'prevent_default' => true to bypass the MLA handler )
mla_list_table_inline_fields(array $fields) : string
Adds Language dropdown and Quick Translate links.
| since | 2.11 |
|---|
arrayThe field names for inline data.
stringupdated fields for inline data.
mla_list_table_inline_parse( $html_markup, $item_template, $item_values) : array
| since |
2.11
Adds Bulk Translate form and the Language dropdown markup used for the Quick and Bulk Edit forms. |
|---|
arrayupdated HTML markup for the Quick and Bulk Edit forms
mla_list_table_inline_values(array $item_values) : array
Builds the Language dropdown and edit translation links for the Quick and Bulk Edit forms, adding them to the 'custom_fields' and 'bulk_custom_fields' substitution parameters.
| since | 2.11 |
|---|
arrayparameter_name => parameter_value pairs
arrayupdated substitution parameter name => value pairs
mla_list_table_prepare_items_pagination(array $pagination, object $mla_list_table) : array
Records the pagination parameters for use with custom table views, e.g., "attached".
| since | 2.11 |
|---|
arrayContains 'per_page', 'current_page'.
objectThe MLA_List_Table object, passed by reference.
arrayupdated pagination array.
mla_list_table_prepare_items_total_items(integer $total_items, object $mla_list_table) : integer
A convenient place to add the query argument required for the "Bulk Translate" custom view.
| since | 2.11 |
|---|
integerNULL, indicating no substitution.
objectThe MLA_List_Table object, passed by reference.
integerupdated total_items.
mla_localize_language_option_definitions() : void
Localization must be done at runtime, and these calls cannot be placed in the "public static" array definition itself.
| since | 2.11 |
|---|---|
mla_mapping_new_text( $new_text, $setting_key, $post_id, $category, $attachment_metadata) : array
| since | 2.20 |
|---|
arrayupdated rule EXIF/Template value
mla_mapping_rule( $setting_value, $post_id, $category, $attachment_metadata)
| since | 2.20 |
|---|---|
mla_media_modal_begin_update_compat_fields( $post)
| since | 2.11 |
|---|---|
mla_media_modal_end_update_compat_fields( $results, $taxonomies, $post)
| since | 2.11 |
|---|---|
mla_media_modal_update_compat_fields_terms( $terms, $key, $value, $post_id)
| since | 2.11 |
|---|---|
mla_render_language_tab() : array
| since | 2.11 |
|---|---|
array( 'message' => '', 'body' => '' )
mla_taxonomy_get_columns( $filter_columns, $columns, $taxonomy) : array
| since | 2.15 |
|---|
arrayNULL or replacement columns array.
mla_updated_single_item(integer $post_id, integer $result)
| since | 2.15 |
|---|---|
integerID of the item that was updated.
integerZero if the update failed else ID of the item that was updated.
pll_translate_media( $duplicated_attachment_id, $duplicated_attachment_object, $translations)
| since | 2.11 |
|---|---|
quick_translate() : void
| since | 2.11 |
|---|---|
MLA_PLL_QUICK_TRANSLATE
| since | |
|---|---|
| var |
polylang_1dot8_plus : boolean
| since | |
|---|---|
| var |
boolean
current_mapping_rule : array
| since | |
|---|---|
| var |
mapping rule |
array
relevant_terms : array
NOTE: WPML uses term_taxonomy_id as the "element_id" in its translations; Polylang uses term_id as the "element_id".
| since | |
|---|---|
| var |
[ $term_taxonomy_id ] => array( $term, $translations ) |
array
existing_terms : array
| since | |
|---|---|
| var |
['element_id'] => $post_id; [ 'language_code' ] => WPML item language or default language, e.g., 'en' [ 'slug' ] => Polylang item language or default language, e.g., 'en' [ $language ][ translation_details ] [ $language ][ $taxonomy ][ $term_taxonomy_id ] => $term |
array
tax_input : array
| since | |
|---|---|
| var |
['tax_input_post_id'] => $post_id; [ $language ][ $taxonomy ] => array of integer term_ids (hierarchical) [ $language ][ $taxonomy ] => comma-delimited string of term names (flat) |
array
bulk_edit_map : array
| since | |
|---|---|
| var |
[ id ] => field name |
array
bulk_edit_request : array
| since | |
|---|---|
| var |
[ field ] => new value |
array
bulk_action_includes : array
| since | |
|---|---|
| var |
array
language_columns : array
| since | |
|---|---|
| var |
array
list_table_parameters : array
| since | |
|---|---|
| var |
array
mla_language_option_definitions :
The array must be populated at runtime in MLA_Polylang::mla_localize_language_option_definitions(), because localization calls cannot be placed in the "public static" array definition itself.
Each option is defined by an array with the elements documented in class-mla-options.php