# MLATemplate_Support

Class MLA (Media Library Assistant) Custom Style/Markup Template Support provides functions that define, import and export custom style and markup templates for MLA shortcodes.

package | Media Library Assistant
since | 2.30

### Methods

## Fetch style or markup template from $mla_templates.

    mla_fetch_custom_template(string $key, string $shortcode = 'gallery', string $type = 'style', string $section = '[not supplied]') : string

static

since | 2.30

### Arguments

#### $key

`string`

Template name.

#### $shortcode

`string`

Optional. Shortcode slug; 'gallery', 'tag-cloud' or 'term-list'. Default 'gallery'.

#### $type

`string`

Optional. Template type; 'style' or 'markup'. Default 'style'.

#### $section

`string`

Optional. Template section. Default '[not supplied]'.

### Response

`string`

Requested template section, if it exists.

## Get ALL markup templates from $mla_custom_templates, including default(s).

    mla_get_markup_templates(string $shortcode = '') : array|null

static

since | 2.30

### Arguments

#### $shortcode

`string`

Optional. Shortcode to which the template(s) apply. Default 'gallery'.

### Response

`array|null`

Array ( name => value ) for all markup templates or null if no templates.

## Get ALL style templates from $mla_custom_templates, including default(s).

    mla_get_style_templates(string $shortcode = '') : array|null

static

since | 2.30

### Arguments

#### $shortcode

`string`

Optional. Shortcode to which the template(s) apply. Default ''.

### Response

`array|null`

Array ( name => value ) for all style templates or null if no templates.

## Load style and markup templates to $mla_custom_templates.

    mla_load_custom_templates() : null

static

since | 2.30

### Response

`null`

## Localize $mla_option_definitions array.

    mla_localize_template_definitions() : null

static

Localization must be done at runtime; these calls cannot be placed in the "public static" array definition itself. Called from MLATest::initialize.

since | 2.30

### Response

`null`

## Put user-defined markup templates to $mla_custom_templates and database

    mla_put_markup_templates(array $templates) : boolean

static

since | 2.30

### Arguments

#### $templates

`array`

Array ( name => value ) for all user-defined markup templates.

### Response

`boolean`

true if success, false if failure.

## Put user-defined style templates to $mla_custom_templates and database

    mla_put_style_templates(array $templates) : boolean

static

since | 2.30

### Arguments

#### $templates

`array`

Array ( name => value ) for all user-defined style templates.

### Response

`boolean`

true if success, false if failure.

### Properties

## $mla_template_definitions defines the structure of the style and markup templates and the labels, etc. required to render them in the Settings/Shortcodes tab.

    mla_template_definitions : array

static

The array must be populated at runtime in MLATemplate_Support::mla_localize_template_definitions(); localization calls cannot be placed in the "public static" array definition itself.

since |
access | public
var | { Definitions by type. Key $$type is 'markup' or 'style'.
    @type array $$type {
        Definitions by shortcode. Key $$shortcode_slug is 'gallery', 'tag-cloud' or 'term-list'

        @type array $$shortcode_slug {
            Templates by name. Key $$template_name is the template name/slug.

            @type string $label Label for the shortcode.
            @type array $default_names Names of the default templates.
            @type array $sections {
                Template section definitions. Key $$section_name is the section name/slug.

                @type array $$section_name {
                    Definitions by section.

                    @type string $label Label for the section textbox.
                    @type integer $rows Number of rows for the section textbox.
                    @type string $help Help text displayed below the textbox.
                    @type integer $order Where the section appears in the template.
                }
            }
       }
} }

### Type(s)

`array`

## Style and Markup templates.

    mla_custom_templates : array

static

since |
access | private
var | { Templates by type. Key $$type is 'markup' or 'style'.
    @type array $$type {
        Templates by shortcode. Key $$shortcode_slug is 'gallery', 'tag-cloud' or 'term-list'

        @type array $$shortcode_slug {
            Templates by name. Key $$template_name is the template name/slug, which must be unique within type.

            @type array $$template_name {
                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(s)

`array`