# MLA_Template_Query

Class MLA (Media Library Assistant) Template Query implements the searchable database of shortcode templates

package | Media Library Assistant
since | 2.40

### Methods

## Query the plugin_examples items

    _execute_template_items_query( $request) : array

static

since | 2.40

### Arguments

#### $request

``

### Response

`array`

query results; array of MLA post_mime_type objects

## Assemble the in-memory representation of the templates items

    _get_shortcode_template_items(boolean $force_refresh = false) : boolean

static

since | 2.40

### Arguments

#### $force_refresh

`boolean`

Optional. Force a reload of items. Default false.

### Response

`boolean`

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

## Sanitize and expand query arguments from request variables

    _prepare_template_items_query( $raw_request,  $offset,  $count) : array

static

since | 2.40

### 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.40

### Arguments

#### $a

`array`

The first array.

#### $b

`array`

The second array.

### Response

`integer`

The comparison result.

## Insert a Shortcode Template given its value array.

    mla_add_shortcode_template(array $value)

static

since | 2.40

### Arguments

#### $value

`array`

MLA Shortcode Template new value.

## Get the total number of MLA shortcode_template objects

    mla_count_template_items( $request) : integer

static

since | 2.40

### Arguments

#### $request

``

### Response

`integer`

Number of MLA shortcode_template objects

## Find an Shortcode Template given its ID

    mla_find_shortcode_template(integer $ID) : array

static

since | 2.40

### Arguments

#### $ID

`integer`

MLA Shortcode Template ID

### Response

`array`

MLA shortcode_template array

## Find a Shortcode Template ID given its type and name

    mla_find_shortcode_template_ID(string $type, string $name) : integer

static

since | 2.40

### Arguments

#### $type

`string`

MLA Shortcode Template type; style or markup.

#### $name

`string`

MLA Shortcode Template name.

### Response

`integer`

Template ID if the template exists else zero (0).

## Flush the in-memory representation of the templates items to option values

    mla_put_shortcode_template_items()

static

since | 2.40

## Retrieve MLA shortcode_template objects for list table display

    mla_query_template_items( $request,  $offset,  $count) : array

static

since | 2.40

### Arguments

#### $request

``

#### $offset

``

#### $count

``

### Response

`array`

MLA shortcode_template objects

## Replace a Shortcode Template given its value array.

    mla_replace_shortcode_template(array $value) : boolean

static

since | 2.40

### Arguments

#### $value

`array`

MLA Shortcode Template new value.

### Response

`boolean`

true if object exists else false.

## Tabulate MLA shortcode_template objects by view for list table display

    mla_tabulate_template_items( $s = '') : array

static

since | 2.40

### Arguments

#### $s

``

### Response

`array`

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

## Update a Shortcode Template field given its ID and key.

    mla_update_shortcode_template(integer $ID, string $key, string $value) : boolean

static

since | 2.40

### Arguments

#### $ID

`integer`

MLA Shortcode Template ID.

#### $key

`string`

MLA Shortcode Template property.

#### $value

`string`

MLA Shortcode Template new value.

### Response

`boolean`

true if object exists else false.

### Properties

## In-memory representation of the template items

    _shortcode_template_items : array

static

since |
var | { Items by ID. Key $$ID is an index number starting with 1.
        @type array $$ID {
            Template elements.

            @type integer $post_ID Template ID; equal to $$ID.
            @type string $type Template type; style or markup.
            @type string $shortcode Shortcode slug this template applies to.
            @type boolean $default True if a default template, false if a custom template.
            @type string $name Template name/slug.
            @type array $sections {
                Template content by section. Key $$section_name is the section name/slug.

                @type string $$section_name HTML markup/CSS styles for the template section.
            }
            @type boolean $changed True if the template has changed since loading.
            @type boolean $deleted True if the template has been deleted since loading.
ID => ( post_ID, type, shortcode, default, name, description, changed, deleted )

### Type(s)

`array`

## Highest existing template ID value

    _shortcode_template_highest_ID : integer

static

since |
var |

### Type(s)

`integer`