Class MLA (Media Library Assistant) Data Source manages data sources for custom field mapping and shortcode execution

package Media Library Assistant
since 2.20

 Methods

Get IPTC/EXIF or custom field mapping data source

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

Defined as public so MLA Mapping Hooks clients can call it. Isolates clients from changes to _evaluate_data_source().

since 2.20

Parameters

$post_id

integer

post->ID of attachment

$category

string

category/scope to evaluate against: custom_field_mapping or single_attachment_mapping

$data_value

array

data source specification ( name, *data_source, *keep_existing, *format, mla_column, quick_edit, bulk_edit, *meta_name, *option, no_null )

$attachment_metadata

array

(optional) _wp_attachment_metadata, default NULL (use current postmeta database value)

Returns

stringarraydata source value

Identify custom field mapping data source

mla_is_data_source(string $candidate_name) : boolean

Determines whether a name matches any of the element-level data source dropdown options, i.e., excludes "template:" and "meta:" values.

since 2.20

Parameters

$candidate_name

string

candidate data source name

Returns

booleantrue if candidate name matches a data source

Evaluate post information for custom field mapping

_evaluate_array_result(array $value, string $option, boolean $keep_existing) : mixed

since 2.20

Parameters

$value

array

field value(s)

$option

string

format option text|single|export|array|multi

$keep_existing

boolean

keep existing value(s) - for 'multi' option

Returns

mixedarray for option = array|multi else string

Evaluate custom field mapping data source

_evaluate_data_source(integer $post_id, string $category, array $data_value, array $attachment_metadata) : string | array

since 2.20

Parameters

$post_id

integer

post->ID of attachment

$category

string

category/scope to evaluate against: custom_field_mapping or single_attachment_mapping

$data_value

array

data source specification ( name, *data_source, *keep_existing, *format, mla_column, quick_edit, bulk_edit, *meta_name, *option, no_null )

$attachment_metadata

array

(optional) _wp_attachment_metadata, default NULL (use current postmeta database value)

Returns

stringarraydata source value

Evaluate file information for custom field mapping

_evaluate_file_information(string $upload_dir, array $wp_attached_files, array $wp_attachment_metadata, integer $post_id) : array

since 2.20

Parameters

$upload_dir

string

absolute path the the uploads base directory

$wp_attached_files

array

_wp_attached_file meta_value array, indexed by post_id

$wp_attachment_metadata

array

_wp_attachment_metadata meta_value array, indexed by post_id

$post_id

integer

post->ID of attachment

Returns

arrayabsolute_path_raw, absolute_path, absolute_file_name_raw, absolute_file_name, absolute_file, base_file, path, file_name, extension, dimensions, width, height, hwstring_small, array of intermediate sizes

 Properties

 

Array of Data Source names for custom field mapping

$custom_field_data_sources : array

since 2.20