model/modx/modtemplate.class.php

Classes 
package
modx
Classes
modTemplate

Description

Represents a content element that serves as a resource template.

\modTemplate

Extends from
\modElement
package
modx
Methods
__construct
getMany
getTemplateVarList
getTemplateVars
hasTemplateVar
listTemplateVars
process
remove
save

Description

Represents a content element that serves as a resource template.

These elements are defined by some type of source content that when processed will provide output or some type of logical result based on mutable properties.

This class creates an instance of a modElement object. This should not be called directly, but rather extended for derivative modElement classes.

Methods

__construct

__construct( \xPDO $xpdo ) : \xPDOObject

Constructor

Do not call the constructor directly; see {@link xPDO::newObject()}.

All derivatives of xPDOObject must redeclare this method, and must call the parent method explicitly before any additional logic is executed, e.g.

public function __construct(xPDO & $xpdo) { parent :: __construct($xpdo); // Any additional constructor tasks here }

Arguments
$xpdo
\xPDO
&$xpdo A reference to a valid xPDO instance.
Output
\xPDOObject
Details
visibility
public
final
false
static
false

getMany

getMany( string $alias, object $criteria = null, boolean|integer $cacheFlag = true ) : array

Gets a collection of objects related by aggregate or composite relations.

{@inheritdoc}

Includes special handling for related objects with alias {@link modTemplateVar}, respecting framework security unless specific criteria are provided.

Arguments
$alias
string
Alias of the foreign class representing the related object.
$criteria
object
xPDOCriteria object to get the related objects
$cacheFlag
booleaninteger
Indicates if the objects should be cached and optionally, by specifying an integer value, for how many seconds.
Output
array
A collection of related objects or an empty array.
Details
visibility
public
final
false
static
false

getTemplateVarList

getTemplateVarList( array $sort = array, integer $limit = 0, integer $offset = 0,  $conditions = array ) : array

Get a list of Template Variables and if they are currently associated to this template.

This is a sortable, scrollable list.

Arguments
$sort
array
An array of criteria for sorting the list.
$limit
integer
An optional limit to apply to the list.
$offset
integer
An optional offset to apply to the list.
$conditions
Output
array
An array containing the collection and total.
Details
visibility
public
final
false
static
false

getTemplateVars

getTemplateVars( ) : array

Grabs an array of Template Variables associated with this Template, bypassing the many-to-many relationship.

Output
array
An array of TVs.
Details
visibility
public
final
false
static
false
access
public

hasTemplateVar

hasTemplateVar( mixed $tvPk ) : boolean

Check to see if this Template is assigned the specified Template Var

Arguments
$tvPk
mixed
Either the ID, name or object of the Template Var
Output
boolean
True if the TV is assigned to this Template
Details
visibility
public
final
false
static
false

listTemplateVars

listTemplateVars( \modTemplate $template, array $sort = array, int $limit = 0, int $offset = 0,  $conditions = array ) : array

Get a sortable, limitable list and total record count of Template Variables.

This list includes an access field indicating their relationship to a modTemplate.

Arguments
$template
\modTemplate
&$template A modTemplate instance.
$sort
array
An array of criteria for sorting the list.
$limit
int
An optional limit to apply to the list.
$offset
int
An optional offset to apply to the list.
$conditions
Output
array
An array with the list collection and total records in the collection.
Details
visibility
public
final
false
static
true
static

process

process( array|string $properties = null, string $content = null ) : mixed

Process the template content and return the output.

{@inheritdoc}

Arguments
$properties
arraystring
A set of configuration properties for the element.
$content
string
Optional content to use in place of any persistent content associated with the element.
Output
mixed
The result of processing.
Details
visibility
public
final
false
static
false

remove

remove( array $ancestors = array ) : boolean

Overrides modElement::remove to add custom error logging.

{@inheritdoc}

Arguments
$ancestors
array
Keeps track of classes which have already been removed to prevent loop with circular references.
Output
boolean
Returns true on success, false on failure.
Details
visibility
public
final
false
static
false

save

save( boolean|integer $cacheFlag = null ) : boolean

Overrides modElement::save to add custom error logging and fire modX-specific events.

{@inheritdoc}

Arguments
$cacheFlag
booleaninteger
Indicates if the saved object(s) should be cached and optionally, by specifying an integer value, for how many seconds before expiring. Overrides the cacheFlag for the object(s).
Output
boolean
Returns true on success, false on failure.
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox 0.11.2.