# MLAOptions

Class MLA (Media Library Assistant) Options manages the plugin option settings and provides functions to get and put them from/to WordPress option variables

Separated from class MLASettings in version 1.00

package | Media Library Assistant
since | 1.00

### Methods

## Generate a list of all (post) Custom Field names

    _get_custom_field_names() : array

static

The list will include any Custom Field and IPTC/EXIF rules that haven't been mapped to any attachments, yet.

since | 1.00

### Response

`array`

Custom field names from the postmeta table and MLA rules

## Build and search a cache of taxonomy and term name to term ID mappings

    _get_term_id( $term_name,  $term_parent,  $taxonomy,  &$post_terms) : integer

static

since | 2.01

### Arguments

#### $term_name

``

#### $term_parent

``

#### $taxonomy

``

#### $post_terms

``

### Response

`integer`

term_id for the term name

## Load option settings templates to $mla_option_templates

    _load_option_templates() : void

static

since | 0.80

## Update _wp_attachment_metadata for just-inserted attachment

    _update_attachment_metadata( $updates,  &$data) : array

static

since | 1.70

### Arguments

#### $updates

``

#### $data

``

### Response

`array`

Attachment metadata updates, with "meta:" elements removed

## Update custom field mappings

    _update_custom_field_mapping( $current_values,  $new_values) : array

static

since | 1.10

### Arguments

#### $current_values

``

#### $new_values

``

### Response

`array`

( 'message' => HTML message(s) reflecting results, 'values' => updated custom_field_mapping values, 'changed' => true if any changes detected else false )

## Update Custom field portion of IPTC/EXIF mappings

    _update_iptc_exif_custom_mapping( $current_values,  $new_values) : array

static

since | 1.00

### Arguments

#### $current_values

``

#### $new_values

``

### Response

`array`

( 'message' => HTML message(s) reflecting results, 'values' => updated iptc_exif_mapping values, 'changed' => true if any changes detected else false )

## Update Standard field portion of IPTC/EXIF mappings

    _update_iptc_exif_standard_mapping( $current_values,  $new_values) : array

static

since | 1.00

### Arguments

#### $current_values

``

#### $new_values

``

### Response

`array`

( 'message' => HTML message(s) reflecting results, 'values' => updated iptc_exif_mapping values, 'changed' => true if any changes detected else false )

## Update Taxonomy term portion of IPTC/EXIF mappings

    _update_iptc_exif_taxonomy_mapping( $current_values,  $new_values) : array

static

since | 1.00

### Arguments

#### $current_values

``

#### $new_values

``

### Response

`array`

( 'message' => HTML message(s) reflecting results, 'values' => updated iptc_exif_mapping values, 'changed' => true if any changes detected else false )

## Initialization function, similar to __construct()

    initialize() : void

static

since | 1.00

## Set $add_attachment_id to just-inserted attachment

    mla_add_attachment_action( $post_ID) : void

static

All of the actual processing is done later, in mla_update_attachment_metadata_filter.

since | 1.00

### Arguments

#### $post_ID

``

## Render and manage Attachment Display Settings options; alignment, link type and size

    mla_attachment_display_settings_option_handler( $action,  $key,  $value,  $args = NULL) : string

static

since | 1.71
uses | contains select_option and select templates

### Arguments

#### $action

``

#### $key

``

#### $value

``

#### $args

``

### Response

`string`

HTML table row markup for 'render' else message(s) reflecting the results of the operation.

## Compose a Custom Field Options list with current selection

    mla_compose_custom_field_option_list( $selection = 'none',  $blacklist = array()) : string

static

since | 1.10
uses | contains row and table templates

### Arguments

#### $selection

``

#### $blacklist

``

### Response

`string`

HTML markup with select field options

## Compose a (Custom Field) Data Source Options list with current selection

    mla_compose_data_source_option_list( $selection = 'none') : string

static

since | 1.10
uses | contains row and table templates

### Arguments

#### $selection

``

### Response

`string`

HTML markup with select field options

## Compose an IPTC Options list with current selection

    mla_compose_iptc_option_list( $selection = 'none') : string

static

since | 1.00
uses | contains row and table templates

### Arguments

#### $selection

``

### Response

`string`

HTML markup with select field options

## Compose an hierarchical taxonomy Parent options list with current selection

    mla_compose_parent_option_list( $taxonomy,  $selection) : string

static

since | 1.00
uses | contains row and table templates

### Arguments

#### $taxonomy

``

#### $selection

``

### Response

`string`

HTML markup with select field options

## Render and manage custom field mapping options

    mla_custom_field_option_handler( $action,  $key,  $value,  $args = NULL) : string

static

since | 1.10
uses | contains row and table templates

### Arguments

#### $action

``

#### $key

``

#### $value

``

#### $args

``

### Response

`string`

HTML table row markup for 'render' else message(s) reflecting the results of the operation.

## Delete the stored value of a defined MLA option

    mla_delete_option( $option,  $option_table = NULL) : boolean

static

Compatibility shim for MLACore::mla_delete_option

since | 0.1

### Arguments

#### $option

``

#### $option_table

``

### Response

`boolean`

True if the option was deleted, otherwise false

## Evaluate custom field mapping updates for a post

    mla_evaluate_custom_field_mapping( $post_id,  $category,  $settings = NULL,  $attachment_metadata = NULL) : array

static

since | 1.10

### Arguments

#### $post_id

``

#### $category

``

#### $settings

``

#### $attachment_metadata

``

### Response

`array`

Updates suitable for MLAData::mla_update_single_item, if any

## Evaluate IPTC/EXIF mapping updates for a post

    mla_evaluate_iptc_exif_mapping( $post,  $category,  $settings = NULL,  $attachment_metadata = NULL,  $is_upload = false) : array

static

since | 1.00

### Arguments

#### $post

``

#### $category

``

#### $settings

``

#### $attachment_metadata

``

#### $is_upload

``

### Response

`array`

Updates suitable for MLAData::mla_update_single_item, if any

## Get IPTC/EXIF or custom field mapping data source; WP_ADMIN mode

    mla_get_data_source( $post_id,  $category,  $data_value,  $attachment_metadata = NULL) : string|array

static

Compatibility shim for MLAData_Source::mla_get_data_source.

since | 1.70

### Arguments

#### $post_id

``

#### $category

``

#### $data_value

``

#### $attachment_metadata

``

### Response

`string|array`

data source value

## Return the stored value or default value of a defined MLA option

    mla_get_option( $option,  $get_default = false,  $get_stored = false,  $option_table = NULL) : mixed

static

Compatibility shim for MLACore::mla_get_option

since | 0.1

### Arguments

#### $option

``

#### $get_default

``

#### $get_stored

``

#### $option_table

``

### Response

`mixed`

Value(s) for the option or false if the option is not a defined MLA option

## Render and manage iptc/exif support options

    mla_iptc_exif_option_handler( $action,  $key,  $value,  $args = NULL) : string

static

since | 1.00
uses | contains row and table templates

### Arguments

#### $action

``

#### $key

``

#### $value

``

#### $args

``

### Response

`string`

HTML table row markup for 'render' else message(s) reflecting the results of the operation.

## Identify custom field mapping data source; WP_ADMIN mode

    mla_is_data_source( $candidate_name) : boolean

static

Compatibility shim for MLAData_Source::mla_is_data_source.

since | 1.80

### Arguments

#### $candidate_name

``

### Response

`boolean`

true if candidate name matches a data source

## Render and manage Search box options, e.g., connector and search fields

    mla_search_option_handler( $action,  $key,  $value,  $args = NULL) : string

static

since | 1.90
uses | contains search-table template

### Arguments

#### $action

``

#### $key

``

#### $value

``

#### $args

``

### Response

`string`

HTML table row markup for 'render' else message(s) reflecting the results of the operation.

## Returns an array of taxonomy names assigned to $support_type

    mla_supported_taxonomies( $support_type = 'support') : array

static

Compatibility shim for MLACore::mla_taxonomy_support

since | 1.90

### Arguments

#### $support_type

``

### Response

`array`

taxonomies assigned to $support_type; can be empty.

## Render and manage taxonomy support options, e.g., Categories and Post Tags

    mla_taxonomy_option_handler( $action,  $key,  $value,  $args = NULL) : string

static

since | 0.30
uses | contains taxonomy-row and taxonomy-table templates

### Arguments

#### $action

``

#### $key

``

#### $value

``

#### $args

``

### Response

`string`

HTML table row markup for 'render' else message(s) reflecting the results of the operation.

## Determine MLA support for a taxonomy, handling the special case where the settings are being updated or reset.

    mla_taxonomy_support( $tax_name,  $support_type = 'support') : boolean|string

static

Compatibility shim for MLACore::mla_taxonomy_support

since | 0.30

### Arguments

#### $tax_name

``

#### $support_type

``

### Response

`boolean|string`

true if the taxonomy is supported in this way else false. string if $tax_name is '' and $support_type is 'filter', returns the taxonomy to filter by.

## Perform IPTC/EXIF and Custom Field mapping on just-inserted attachment

    mla_update_attachment_metadata_filter( $data,  $post_id) : array

static

This filter tests the $add_attachment_id variable set by the mla_add_attachment_action to ensure that mapping is only performed for new additions, not metadata updates.

since | 1.10

### Arguments

#### $data

``

#### $post_id

``

### Response

`array`

Updated attachment metadata

## Add or update the stored value of a defined MLA option

    mla_update_option( $option,  $newvalue,  $option_table = NULL) : boolean

static

Compatibility shim for MLACore::mla_update_option

since | 0.1

### Arguments

#### $option

``

#### $newvalue

``

#### $option_table

``

### Response

`boolean`

True if the value was changed or false if the update failed

## Called once for each file uploaded

    mla_wp_handle_upload_filter( $file) : array

static

since | 1.70

### Arguments

#### $file

``

### Response

`array`

updated file parameters

## Examine or alter the filename before the file is made permanent

    mla_wp_handle_upload_prefilter_filter( $file) : array

static

since | 1.70

### Arguments

#### $file

``

### Response

`array`

updated file parameters

### Properties

## Option Setting templates

    mla_option_templates : array

static

since |
var |

### Type(s)

`array`

## Attachment ID passed from mla_add_attachment_action to mla_update_attachment_metadata_filter

    add_attachment_id : integer

static

Ensures that IPTC/EXIF and Custom Field mapping is only performed when the attachment is first added to the Media Library.

since |
var |

### Type(s)

`integer`