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, string $type, string $section) : string | boolean | null

since 2.30

Parameters

$key

string

Template name

$shortcode

string

Shortcode slug; 'gallery' (default), 'tag-cloud' or 'term-list'

$type

string

Template type; 'style' (default) or 'markup'

$section

string

Template section (markup templates); default '[not supplied]'

Returns

stringbooleannullrequested template, false if not found or null if no templates

Get ALL markup templates from $mla_custom_templates, including 'default'

mla_get_markup_templates(string $shortcode) : array | null

since 2.30

Parameters

$shortcode

string

Shortcode to which the template(s) apply; default 'gallery'

Returns

arraynullname => value for all markup templates or null if no templates

Get ALL style templates from $mla_custom_templates, including 'default'

mla_get_style_templates(string $shortcode) : array | null

since 2.30

Parameters

$shortcode

string

Shortcode to which the template(s) apply; default ''

Returns

arraynullname => value for all style templates or null if no templates

Load style and markup templates to $mla_custom_templates

mla_load_custom_templates() : void

since 2.30

Localize $mla_option_definitions array

mla_localize_template_definitions() : void

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

Put user-defined markup templates to $mla_custom_templates and database

mla_put_markup_templates(array $templates) : boolean

since 2.30

Parameters

$templates

array

name => value for all user-defined markup templates

Returns

booleantrue if success, false if failure

Put user-defined style templates to $mla_custom_templates and database

mla_put_style_templates(array $templates) : boolean

since 2.30

Parameters

$templates

array

name => value for all user-defined style templates

Returns

booleantrue if success, false if failure

 Properties

 

$mla_template_definitions defines the structure of the style and markup templates and the labels, etc.

$mla_template_definitions 

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.

Template types are indexed by 'style'/'markup' and then shortcode name. Each template type is defined by: 'slug' => Sanitized version of the shortcode name 'default_names' => Names of the default templates 'label' => Styles only; label for the template textbox 'help' => Styles only; help text displayed below the textbox 'sections' => Markup only; array of template section definitions 'sections'[] elements: 'label' => Label for the section textbox 'help' => Help text displayed below the textbox 'order' => Where the section appears in the template

 

Style and Markup templates

$mla_custom_templates : array

Templates are indexed by 'style'/'markup' and then shortcode name. Each template type is defined by:

since 2.30