CMS Made Simple API

CmsLayoutTemplateType
in package

A class to manage template types

Tags
license

GPL

since
2.0
author

Robert Campbell calguy1000@gmail.com

Table of Contents

Constants

CORE  = '__CORE__'
This constant indicates a core template type

Methods

create_new_template()  : CmsLayoutTemplate
Create a new template of ths type
delete()  : mixed
Delete the current object from the database (if it has been saved).
get_all()  : array<string|int, mixed>
Load all template types
get_assistant()  : TemplateTypeAssistant
Get the assistant object with utility methods for this template type (if such an assistant object can be instantiated)
get_content_block_flag()  : bool
Get the content block flag The content block flag indicates that this template type requires content blocks
get_content_callback()  : mixed
Return the callback used to reset a template to its factory default values.
get_create_date()  : intUnix
Get the date that this object was created.
get_description()  : string
Get the template type description.
get_dflt_contents()  : string
Get the default contents used when creating a new template of this type.
get_dflt_flag()  : bool
Get the flag indicating if this template type can have a 'default'
get_dflt_template()  : CmsLayoutTemplate
Get the default template of ths type
get_help_callback()  : mixed
Return the callback used to retrieve help for this template type.
get_id()  : int
Get the template type id
get_lang_callback()  : mixed
Return the callback used to translate the originator and name strings.
get_langified_display_value()  : mixed
Get a translated/pretty displayable name for this template type including the originator.
get_loaded_types()  : array<string|int, mixed>
Return the names of all loaded template types
get_modified_date()  : intUnix
Get the date that this object was last modified
get_name()  : string
Return the template type name.
get_oneonly_flag()  : bool
Get the flag indicating that a maximum of one template of this type is permitted.
get_originator()  : string
Get the template originator (this is usually a module name)
get_owner()  : int
Get the owner of this template type.
get_template_helptext()  : mixed
Get HTML text for help with respect to the variables available in this template type.
get_template_list()  : array<string|int, mixed>
Get a list of templates for the current template type.
get_usage_string()  : string
Get a usage string for this template type.
load()  : CmsLayoutTemplateType
Load a CmsLayoutTemplateType object from the database.
load_all_by_originator()  : array<string|int, mixed>
Load all of the template types for a certain originator.
load_bulk()  : mixed
Load template type objects by specifying an array of ids
reset_content_to_factory()  : mixed
Reset the default contens of this template type back to factory defaults
save()  : mixed
Save the current record to the database.
set_content_block_flag()  : mixed
Set the content block flag to indicate that this template type requires content blocks
set_content_callback()  : mixed
Set a callback to be used when restoring the 'default content' to system default values.
set_description()  : mixed
Set the description for this template.
set_dflt_contents()  : mixed
Set the default content used when creating a new templateof this type.
set_dflt_flag()  : mixed
Set the flag indicating if this template type can have a 'default'
set_help_callback()  : mixed
Set a callback to be used to display help for this template when editing.
set_lang_callback()  : mixed
Set a callback to be used to retrieve a translated version of the originator and name strings.
set_name()  : mixed
Set the template type name
set_oneonly_flag()  : mixed
Set the flag indicating that a maximum of one template of this type is permitted.
set_originator()  : mixed
Set the template originator string.
set_owner()  : mixed
Set the owner of this template type
_insert()  : mixed
A function to insert the current type object into the database.
_update()  : mixed
A function to update the contents of the database to match th current record.
validate()  : mixed
Validate the integrity of a template type object.

Constants

Methods

create_new_template()

Create a new template of ths type

public & create_new_template([string $name = '' ]) : CmsLayoutTemplate

This method will throw an exception if the template cannot be created.

Parameters
$name : string = ''

The template name

Return values
CmsLayoutTemplate

object, or null.

get_all()

Load all template types

public static get_all() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of CmsLayoutTemplateType objects

get_content_block_flag()

Get the content block flag The content block flag indicates that this template type requires content blocks

public get_content_block_flag() : bool
Return values
bool

get_content_callback()

Return the callback used to reset a template to its factory default values.

public get_content_callback() : mixed

get_create_date()

Get the date that this object was created.

public get_create_date() : intUnix
Return values
intUnix

timestamp representing the creation date. or null if this object has not been saved.

get_dflt_contents()

Get the default contents used when creating a new template of this type.

public get_dflt_contents() : string
Return values
string

get_dflt_flag()

Get the flag indicating if this template type can have a 'default'

public get_dflt_flag() : bool
Return values
bool

get_help_callback()

Return the callback used to retrieve help for this template type.

public get_help_callback() : mixed

get_id()

Get the template type id

public get_id() : int
Return values
int

type id, or null if this record has no id.

get_lang_callback()

Return the callback used to translate the originator and name strings.

public get_lang_callback() : mixed

get_langified_display_value()

Get a translated/pretty displayable name for this template type including the originator.

public get_langified_display_value() : mixed

get_loaded_types()

Return the names of all loaded template types

public static get_loaded_types() : array<string|int, mixed>
Return values
array<string|int, mixed>

Associative array of loaded type objects.

get_modified_date()

Get the date that this object was last modified

public get_modified_date() : intUnix
Return values
intUnix

timestamp representing the modification date. or null if this object has not been saved.

get_oneonly_flag()

Get the flag indicating that a maximum of one template of this type is permitted.

public get_oneonly_flag() : bool
Return values
bool

get_originator()

Get the template originator (this is usually a module name)

public get_originator([bool $viewable = FALSE ]) : string
Parameters
$viewable : bool = FALSE

Should the originator name be the viewable (friendly) string?

Return values
string

get_template_helptext()

Get HTML text for help with respect to the variables available in this template type.

public get_template_helptext() : mixed

get_template_list()

Get a list of templates for the current template type.

public get_template_list() : array<string|int, mixed>
Tags
see
CmsLayoutTemplate::list_by_type
Return values
array<string|int, mixed>

of CmsLayoutTemplate objects. or null.

get_usage_string()

Get a usage string for this template type.

public get_usage_string(string $name) : string
Parameters
$name : string

The name of the template object.

Tags
since
2.2
Return values
string

load_all_by_originator()

Load all of the template types for a certain originator.

public static load_all_by_originator(string $originator) : array<string|int, mixed>

This method will throw exceptions if an error is encounted.

Parameters
$originator : string

The origiator name

Tags
throws
CmsInvalidDataException
Return values
array<string|int, mixed>

An array of CmsLayoutTemplateType objects, or null if no matches are found.

load_bulk()

Load template type objects by specifying an array of ids

public static load_bulk(array<string|int, int> $list) : mixed
Parameters
$list : array<string|int, int>

Array of template type ids

set_content_block_flag()

Set the content block flag to indicate that this template type requires content blocks

public set_content_block_flag(bool $flag) : mixed
Parameters
$flag : bool

set_content_callback()

Set a callback to be used when restoring the 'default content' to system default values.

public set_content_callback(callable $data) : mixed

Modules typically distribut sample templates. This callback function is used when the user clicks on a button to reset the selected template type to it's factory default values.

Parameters
$data : callable

A static function name string, or an array of class name and member name.

set_description()

Set the description for this template.

public set_description(string $str) : mixed
Parameters
$str : string

The default template contents.

set_dflt_contents()

Set the default content used when creating a new templateof this type.

public set_dflt_contents(string $str) : mixed
Parameters
$str : string

The default template contents.

set_help_callback()

Set a callback to be used to display help for this template when editing.

public set_help_callback(callable $callback) : mixed
Parameters
$callback : callable

A static function name, or an array of a class name and member name.

set_lang_callback()

Set a callback to be used to retrieve a translated version of the originator and name strings.

public set_lang_callback(callable $data) : mixed

This callback must be a static string representing a static function name, or an array representing a class name and method name. This callback (if set) will be used to translate the originator string, and the name string to something suitable to users language.

Parameters
$data : callable

A static function name string, or an array of class name and member name.

_insert()

A function to insert the current type object into the database.

protected _insert() : mixed

This method will ensure that the current object is valid, generate an id, and insert the record into the database. An exception will be thrown if errors occur.

Tags
throws
CmsSQLErrorException

_update()

A function to update the contents of the database to match th current record.

protected _update() : mixed

This method will ensure that the current object is valid, generate an id, and update the record in the database. An exception will be thrown if errors occur.

Tags
throws
CmsSQLErrorException

validate()

Validate the integrity of a template type object.

protected validate([bool $is_insert = TRUE ]) : mixed

This method will check the contents of the object for validity, and ensure that the originator/name combination are unique.

This method throws an exception if an error is found in the integrity of the object.

Parameters
$is_insert : bool = TRUE

Wether this is a new insert, or an update.

Tags
throws
CmsInvalidDataException

        
On this page

Search results