Abstract Class modElement

Description

Represents an element of source content managed by MODx.

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.

  • abstract: Implement a derivative of this class to represent an element which can be processed within the MODx framework.
  • extends: modAccessibleSimpleObject

Located in /model/modx/modelement.class.php (line 37)

xPDOObject
   |
   --modAccessibleObject
      |
      --modAccessibleSimpleObject
         |
         --modElement
Direct descendents
Class Description
 class modChunk Represents a chunk of static HTML content.
Abstract class modScript An element representing executable PHP script content.
 class modTemplate Represents a content element that serves as a resource template.
 class modTemplateVar Represents a template variable element.
Variable Summary
 boolean $_cacheable
 string $_content
 array $_filters
 string $_output
 boolean $_processed
 array $_properties
 boolean $_result
 string $_tag
 string $_token
Method Summary
 boolean addPropertySet (string|modPropertySet $propertySet)
 void cache ()
 void filterInput ()
 void filterOutput ()
 void findPolicy ([ $context = ''])
 void get ( $k, [ $format = null], [ $formatTemplate = null])
 string getContent ([ $options = array()])
 modInputFilter|null &getInputFilter ()
 modOutputFilter|null &getOutputFilter ()
 array getProperties ([array|string $properties = null])
 array|null getPropertySet ([string|null $setName = null])
 string getTag ()
 string getToken ()
 boolean isCacheable ()
 mixed process ([array|string $properties = null], [string $content = null])
 void remove ([ $ancestors = array ()])
 boolean removePropertySet (string|modPropertySet $propertySet)
 void set ( $k, [ $v = null], [ $vType = ''])
 void setCacheable ([boolean $cacheable = true])
 boolean setContent (mixed $content, [ $options = array()])
 boolean setProperties (array|string $properties, [boolean $merge = false])
 void setTag (string $tag)
 void setToken (string $token)
 array toPlaceholders (array $placeholders)
Variables
boolean $_cacheable = true (line 86)
  • var: If the element is cacheable or not.
  • access: public
string $_content = '' (line 55)

The source content of the element.

  • access: public
array $_filters = array('input' => null, 'output' => null) (line 96)
  • var: Optional filters that can be used during processing.
  • access: public
array $_invalidCharacters = array('!','@','#','$','%','^','&','*',
'(',')','+','=','[',']','{','}','\'','"',';',':','\\','/','<','>','?'
,' ',',','`','~')
(line 102)
  • var: A list of invalid characters in the name of an Element.
  • access: protected
string $_output = '' (line 61)

The output of the element.

  • access: public
boolean $_processed = false (line 91)
  • var: Indicates if the element was processed already.
  • access: public
array $_properties = null (line 43)

The property value array for the element.

  • access: public
string $_propertyString = '' (line 49)

The string representation of the element properties.

  • access: public
boolean $_result = true (line 69)

The boolean result of the element.

This is typically only applicable to elements that use PHP source content.

  • access: public
string $_tag = null (line 75)

The tag signature of the element instance.

  • access: public
string $_token = '' (line 81)

The character token which helps identify the element class in tag string.

  • access: public

Inherited Variables

Inherited from modAccessibleObject

modAccessibleObject::$_policies

Inherited from xPDOObject

xPDOObject::$container
xPDOObject::$fieldNames
xPDOObject::$xpdo
xPDOObject::$_aggregates
xPDOObject::$_alias
xPDOObject::$_cacheFlag
xPDOObject::$_class
xPDOObject::$_composites
xPDOObject::$_dirty
xPDOObject::$_fieldMeta
xPDOObject::$_fields
xPDOObject::$_lazy
xPDOObject::$_new
xPDOObject::$_options
xPDOObject::$_package
xPDOObject::$_pk
xPDOObject::$_pktype
xPDOObject::$_relatedObjects
xPDOObject::$_table
xPDOObject::$_tableMeta
xPDOObject::$_validated
xPDOObject::$_validationLoaded
xPDOObject::$_validationRules
xPDOObject::$_validator
Methods
addPropertySet (line 567)

Add a property set to this element, making it available for use.

  • return: True if a relationship was created or already exists.
  • access: public
boolean addPropertySet (string|modPropertySet $propertySet)
  • string|modPropertySet $propertySet: A modPropertySet object or the name of a modPropertySet object to create a relationship with.
cache (line 263)

Cache the current output of this element instance by tag signature.

  • access: public
void cache ()
filterInput (line 315)

Apply an input filter to an element.

This is called by default in modElement::process() after the element properties have been parsed.

  • access: public
void filterInput ()
filterOutput (line 331)

Apply an output filter to an element.

Call this method in your {modElement::process()} implementation when it is appropriate, typically once all processing has been completed, but before any caching takes place.

  • access: public
void filterOutput ()
findPolicy (line 343)

Loads the access control policies applicable to this element.

  • access: public
void findPolicy ([ $context = ''])
  • $context

Redefinition of:
modAccessibleObject::findPolicy()
Find access policies applicable to this object in a specific context.

Redefined in descendants as:
get (line 130)

Overrides xPDOObject::get to handle when retrieving the properties field for an Element.

  • access: public
void get ( $k, [ $format = null], [ $formatTemplate = null])
  • $k
  • $format
  • $formatTemplate

Redefinition of:
xPDOObject::get()
Get a field value (or a set of values) by the field key(s) or name(s).
getContent (line 388)

Gets the raw, unprocessed source content for this element.

  • return: The raw source content for the element.
  • access: public
string getContent ([ $options = array()])
  • array $options: An array of options implementations can use to accept language, revision identifiers, or other information to alter the behavior of the method.

Redefined in descendants as:
getInputFilter (line 274)

Get an input filter instance configured for this Element.

  • return: An input filter instance (or null if one cannot be loaded).
  • access: public
modInputFilter|null &getInputFilter ()
getOutputFilter (line 293)

Get an output filter instance configured for this Element.

  • return: An output filter instance (or null if one cannot be loaded).
  • access: public
modOutputFilter|null &getOutputFilter ()
getProperties (line 422)

Get the properties for this element instance for processing.

  • return: A simple array of properties ready to use for processing.
  • access: public
array getProperties ([array|string $properties = null])
  • array|string $properties: An array or string of properties to apply.
getPropertySet (line 453)

Gets a named property set related to this element instance.

If a setName parameter is not provided, this function will attempt to extract a setName from the element name using the @ symbol to delimit the name of the property set.

Here is an example of an element tag using the @ modifier to specify a property set name: [[ElementName@PropertySetName:FilterCommand=`FilterModifier`? &PropertyKey1=`PropertyValue1` &PropertyKey2=`PropertyValue2` ]]

  • return: An array of properties or null if no set is found.
  • access: public
array|null getPropertySet ([string|null $setName = null])
  • string|null $setName: An explicit property set name to search for.

Redefined in descendants as:
getTag (line 173)

Constructs a valid tag representation of the element.

  • return: A tag representation of the element.
  • access: public
string getTag ()
getToken (line 209)

Accessor method for the token class var.

  • return: The token for this element tag.
  • access: public
string getToken ()
isCacheable (line 617)

Indicates if the element is cacheable.

  • return: True if the element can be stored to or retrieved from the element cache.
  • access: public
boolean isCacheable ()
process (line 243)

Process the element source content to produce a result.

  • return: The result of processing.
  • abstract: Implement this to define behavior for a MODx content element.
  • access: public
mixed process ([array|string $properties = null], [string $content = null])
  • array|string $properties: A set of configuration properties for the element.
  • string $content: Optional content to use in place of any persistent content associated with the element.

Redefined in descendants as:
remove (line 161)

Overrides xPDOObject::remove to remove all Property Sets that are related to this object.

  • access: public
void remove ([ $ancestors = array ()])
  • array $ancestors

Redefinition of:
modAccessibleObject::remove()
Custom remove that respects access policies.

Redefined in descendants as:
  • modChunk::remove() : Overrides modElement::remove to add custom error logging and fire modX-specific events.
  • modPlugin::remove() : Overrides modElement::remove to add custom error logging and fire modX-specific events.
  • modSnippet::remove() : Overrides modElement::remove to add custom error logging and fire modX-specific events.
  • modTemplate::remove() : Overrides modElement::remove to add custom error logging.
  • modTemplateVar::remove() : Overrides modElement::remove to add custom error logging and fire modX-specific events.
removePropertySet (line 597)

Remove a property set from this element, making it unavailable for use.

  • return: True if a relationship was destroyed.
  • access: public
boolean removePropertySet (string|modPropertySet $propertySet)
  • string|modPropertySet $propertySet: A modPropertySet object or the name of a modPropertySet object to dissociate from.
set (line 111)

Overrides xPDOObject::set to strip invalid characters from element names.

{@inheritDoc}

  • access: public
void set ( $k, [ $v = null], [ $vType = ''])
  • $k
  • $v
  • $vType

Redefinition of:
xPDOObject::set()
Set a field value by the field key or name.

Redefined in descendants as:
  • modScript::set() : Override set to properly strip invalid tags from script code
setCacheable (line 628)

Sets the runtime cacheability of the element.

  • access: public
void setCacheable ([boolean $cacheable = true])
  • boolean $cacheable: Indicates the value to set for cacheability of this element.
setContent (line 410)

Set the raw source content for this element.

  • return: True indicates the content was set.
  • access: public
boolean setContent (mixed $content, [ $options = array()])
  • mixed $content: The source content; implementations can decide if it can only be a string, or some other source from which to retrieve it.
  • array $options: An array of options implementations can use to accept language, revision identifiers, or other information to alter the behavior of the method.

Redefined in descendants as:
setProperties (line 491)

Set default properties for this element instance.

  • return: true if the properties are set.
  • access: public
boolean setProperties (array|string $properties, [boolean $merge = false])
  • array|string $properties: A property array or property string.
  • boolean $merge: Indicates if properties should be merged with existing ones.
setTag (line 227)

Setter method for the tag class var.

  • access: public
void setTag (string $tag)
  • string $tag: The tag to use for this element.
setToken (line 218)

Setter method for the token class var.

  • access: public
void setToken (string $token)
  • string $token: The token to use for this element tag.
toPlaceholders (line 641)

Turns associative arrays into placeholders in the scope of this element.

  • return: An array of placeholders overwritten from the containing scope you can use to restore values from, or an empty array if no placeholders were overwritten.
  • deprecated: To be removed in 2.1. See xPDO::toPlaceholders() for similar functionality.
  • access: public
array toPlaceholders (array $placeholders)
  • array $placeholders: An associative array of placeholders to set.

Inherited Methods

Inherited From modAccessibleObject

 modAccessibleObject::checkPolicy()
 modAccessibleObject::findPolicy()
 modAccessibleObject::getPolicies()
 modAccessibleObject::load()
 modAccessibleObject::loadCollection()
 modAccessibleObject::remove()
 modAccessibleObject::save()
 modAccessibleObject::setPolicies()
 modAccessibleObject::_loadCollectionInstance()
 modAccessibleObject::_loadInstance()

Inherited From xPDOObject

 xPDOObject::__construct()
 xPDOObject::addMany()
 xPDOObject::addOne()
 xPDOObject::addValidationRule()
 xPDOObject::encode()
 xPDOObject::fromArray()
 xPDOObject::fromJSON()
 xPDOObject::get()
 xPDOObject::getFieldName()
 xPDOObject::getFKClass()
 xPDOObject::getFKDefinition()
 xPDOObject::getMany()
 xPDOObject::getOne()
 xPDOObject::getOption()
 xPDOObject::getPK()
 xPDOObject::getPKType()
 xPDOObject::getPrimaryKey()
 xPDOObject::getSelectColumns()
 xPDOObject::getValidator()
 xPDOObject::isDirty()
 xPDOObject::isLazy()
 xPDOObject::isNew()
 xPDOObject::isValidated()
 xPDOObject::load()
 xPDOObject::loadCollection()
 xPDOObject::loadCollectionGraph()
 xPDOObject::remove()
 xPDOObject::removeValidationRules()
 xPDOObject::save()
 xPDOObject::set()
 xPDOObject::setDirty()
 xPDOObject::setOption()
 xPDOObject::toArray()
 xPDOObject::toJSON()
 xPDOObject::validate()
 xPDOObject::_getAliases()
 xPDOObject::_getDataType()
 xPDOObject::_getPHPType()
 xPDOObject::_getRelatedObjectsByFK()
 xPDOObject::_initFields()
 xPDOObject::_loadCollectionInstance()
 xPDOObject::_loadFieldData()
 xPDOObject::_loadInstance()
 xPDOObject::_loadRows()
 xPDOObject::_loadValidation()
 xPDOObject::_saveRelatedObject()
 xPDOObject::_saveRelatedObjects()
 xPDOObject::_setRaw()

Documentation generated on Fri, 17 Jun 2011 10:03:33 -0600 by phpDocumentor 1.4.3