\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.

Summary

Methods
Properties
Constants
mla_localize_template_definitions()
mla_load_custom_templates()
mla_fetch_custom_template()
mla_get_style_templates()
mla_put_style_templates()
mla_get_markup_templates()
mla_put_markup_templates()
$mla_template_definitions
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$mla_custom_templates
N/A

Properties

$mla_template_definitions

$mla_template_definitions : array

$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.

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.

Type

array — { 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. } } } } }

$mla_custom_templates

$mla_custom_templates : array

Style and Markup templates.

Type

array — { 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. } } } }

Methods

mla_localize_template_definitions()

mla_localize_template_definitions() : null

Localize $mla_option_definitions array.

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

Returns

null

mla_load_custom_templates()

mla_load_custom_templates() : null

Load style and markup templates to $mla_custom_templates.

Returns

null

mla_fetch_custom_template()

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

Fetch style or markup template from $mla_templates.

Parameters

string $key

Template name.

string $shortcode

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

string $type

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

string $section

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

Returns

string —

Requested template section, if it exists.

mla_get_style_templates()

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

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

Parameters

string $shortcode

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

Returns

array|null —

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

mla_put_style_templates()

mla_put_style_templates(array  $templates) : boolean

Put user-defined style templates to $mla_custom_templates and database

Parameters

array $templates

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

Returns

boolean —

true if success, false if failure.

mla_get_markup_templates()

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

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

Parameters

string $shortcode

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

Returns

array|null —

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

mla_put_markup_templates()

mla_put_markup_templates(array  $templates) : boolean

Put user-defined markup templates to $mla_custom_templates and database

Parameters

array $templates

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

Returns

boolean —

true if success, false if failure.