CmsLayoutCollection View code

A class to manage a collection (or theme) of Templates and Stylesheets

package

CMS

license

GPL

since 2.0
author

Robert Campbell calguy1000@gmail.com

Methods

get_id() : integer

Get the theme id Only themes that have been saved to the database have an id.

Response

integer

get_name() : string

Get the theme name

Response

string

set_name(string $str) 

Set the theme name This marks the theme as dirty

Arguments

string $str

get_default() : boolean

Get the default flag Note, only one theme can be the default.

Response

boolean

set_default(boolean $flag) 

Sets this theme as the default theme.

Sets the dirty flag. Note, only one theme can be the default.

Arguments

boolean $flag

get_description() : string

Get the theme description

Response

string

set_description(string $str) 

Set the theme description

Arguments

string $str

get_created() : integer

Get the creation date of this theme The creation date is specified automatically on the first save

Response

integer

get_modified() : integer

Get the date of the last modification of this theme

Response

integer

has_stylesheets() : boolean

Test if this theme has stylesheets attached to it

Response

boolean

get_stylesheets() : array

Get the list of stylesheets (if any) associated with this theme.

Response

array

of integers

set_stylesheets(array $id_array) 

Set the list of stylesheets associated with this theme

Arguments

array $id_array

Array of integer stylesheet ids.

add_stylesheet(mixed $css) 

Adds a stylesheet to the theme

Arguments

mixed $css

Either an integer stylesheet id, or a CmsLayoutStylesheet object

delete_stylesheet(mixed $css) 

Delete a stylesheet from the list of stylesheets associated with this theme

Arguments

mixed $css

Either an integer stylesheet id, or a CmsLayoutStylesheet object

has_templates() : boolean

Test if this theme has templates associated with it

Response

boolean

get_templates() : array

Return a list of the template ids associated with this template

Response

array

of integers

set_templates(array $id_array) 

Set the list of templates associated with this theme

Arguments

array $id_array

Array of integer template ids

add_template(mixed $tpl) 

Add a template to the list of templates associated with this theme.

Arguments

mixed $tpl

Accepts either an integer template id, or an instance of a CmsLayoutTemplate object

delete_template(mixed $tpl) 

Delete a template from the list of templates associated with this theme

Arguments

mixed $tpl

Either an integer template id, or a CmsLayoutTemplate object

validate() 

Validate this object before saving.

save() 

Save this theme This method will send the AddDesignPre and AddDesignPost events before and after saving a new theme and the EditDesignPre and EditDesignPost events before and after saving an existing theme.

delete(boolean $force = FALSE) 

Delete the current theme This class will not allow deleting themes that still have templates associated with them.

Arguments

boolean $force

Force deleting the theme even if there are templates attached

load(mixed $x) : \CmsLayoutCollection

Load a theme object

static

Arguments

mixed $x

  • Accepts either an integer theme id, or a theme name,

Response

\CmsLayoutCollection

get_all(string $quick = FALSE) : array

Load all themes

static

Arguments

string $quick

Do not load the templates and stylesheets.

Response

array

Array of CmsLayoutCollection objects.

get_list() 

Get a list of designs

static
load_default() : \CmsLayoutCollection

Load the default theme

static
suggest_name(string $newname = '') : string

Given a base name, suggest a name for a copied theme

static

Arguments

string $newname

Response

string