MLA_Custom_Field_Query

Class MLA (Media Library Assistant) Custom Field Query implements the searchable database of custom field mapping rules.

package

Media Library Assistant

since 2.50

Methods

Query the plugin_examples items

_execute_custom_field_rules_query( $request) : array
static
since 2.50

Arguments

$request

Response

array

query results; array of MLA post_mime_type objects

Assemble the in-memory representation of the custom field rules

_get_custom_field_rules(boolean $force_refresh = false) : boolean
static
since 2.50

Arguments

$force_refresh

boolean

Optional. Force a reload of rules. Default false.

Response

boolean

Success (true) or failure (false) of the operation

Sanitize and expand query arguments from request variables

_prepare_custom_field_rules_query( $raw_request,  $offset,  $count) : array
static
since 2.50

Arguments

$raw_request

$offset

$count

Response

array

revised arguments suitable for query

Callback to sort array by a 'name' key.

_sort_uname_callback(array $a, array $b) : integer
static
since 2.50

Arguments

$a

array

The first array.

$b

array

The second array.

Response

integer

The comparison result.

Insert a Custom Field Rule given its value array.

mla_add_custom_field_rule(array $value) : boolean
static
since 2.50

Arguments

$value

array

MLA Custom Field Rule new value.

Response

boolean

true if addition succeeds else false.

Convert a Custom Field Rule to an old-style mapping rule, given its ID

mla_convert_custom_field_rules(integer|array $rule_ids) : array
static
since 2.50

Arguments

$rule_ids

integer|array

| array( $IDs ) MLA Custom Field Rule ID(s)

Response

array

MLA custom_field_mapping values (can be empty)

Get the total number of MLA custom_field_rule objects

mla_count_custom_field_rules( $request) : integer
static
since 2.50

Arguments

$request

Response

integer

Number of MLA custom_field_rule objects

Return the custom field rule names

mla_custom_field_rule_names() : array
static
since 2.50

Response

array

MLA custom_field_rule name => name

Find a Custom Field Rule given its ID

mla_find_custom_field_rule(integer $ID) : array
static
since 2.50

Arguments

$ID

integer

MLA Custom Field Rule ID

Response

array

MLA custom_field_rule array

Find a Custom Field Rule ID given its rule name

mla_find_custom_field_rule_ID(string $rule_name) : integer
static
since 2.50

Arguments

$rule_name

string

MLA Custom Field Rule name.

Response

integer

Rule ID if the rule exists else zero (0).

Flush the in-memory representation of the custom field rules to the option value

mla_put_custom_field_rules() 
static
since 2.50

Retrieve MLA custom_field_rule objects for list table display

mla_query_custom_field_rules( $request,  $offset,  $count) : array
static
since 2.50

Arguments

$request

$offset

$count

Response

array

MLA custom_field_rule objects

Replace a Custom Field Rule given its value array.

mla_replace_custom_field_rule(array $value) : boolean
static
since 2.50

Arguments

$value

array

MLA Custom Field Rule new value.

Response

boolean

true if object exists else false.

Tabulate MLA custom_field_rule objects by view for list table display

mla_tabulate_custom_field_items( $s = '') : array
static
since 2.50

Arguments

$s

Response

array

( 'singular' label, 'plural' label, 'count' of items )

Update a Custom Field Rule property given its ID and key.

mla_update_custom_field_rule(integer $ID, string $key, string $value) : boolean
static
since 2.50

Arguments

$ID

integer

MLA Custom Field Rule ID.

$key

string

MLA Custom Field Rule property.

$value

string

MLA Custom Field Rule new value.

Response

boolean

true if object exists else false.

Properties

In-memory representation of the custom field mapping rules

_custom_field_rules : array
static
since
var

{ Items by ID. Key $$ID is an index number starting with 1.

    @type array $$ID {
        Rule elements.

        @type integer $post_ID Rule ID; equal to $$ID.
        @type string $rule_name Rule name, to accomodate an old bug.
        @type string $name Custom field name the rule applies to.
        @type string $data_source Data source name, 'none', 'meta' or 'template'.
        @type string $meta_name if ( $data_source = 'meta' ) attachment metadata element name,
                                if ( $data_source = 'template ) template value w/o "template:"
        @type string $format Output format, 'native', 'commas' or 'raw'.
        @type string $option Output option, 'text', 'single'. 'array' or 'multi'.
        @type boolean $keep_existing Retain existing value(s), do not replace them.
        @type boolean $no_null Delete empty (NULL) values.
        @type boolean $mla_column Display the field as a Media/Assistant submenu table column.
        @type boolean $quick_edit Add the field to the Media/Assistant submenu table Quick Edit area.
        @type boolean $bulk_edit Add the field to the Media/Assistant submenu table Bulk Edit area.
        @type boolean $inline_edit OBSOLETE - no longer used.
        @type boolean $active True if rule should be applied during mapping.
        @type boolean $read_only True if rule_name !== name, to prevent editing of "old bug" rules.
        @type boolean $changed True if the rule has changed since loading.
        @type boolean $deleted True if the rule has been deleted since loading.
    }

Type(s)

array

Highest existing custom field rule ID value

_custom_field_rule_highest_ID : integer
static
since
var

Type(s)

integer