core/model/modx/modparser.class.php
MODX Revolution
Copyright 2006-2012 by MODX, LLC. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Package
- modx
\modFieldTag
Tag representing a modResource field from the current MODX resource.
[[*content]] Represents the content field from modResource.
- Parent(s)
- \modTag
- Uses
- \modX::$resource
Properties
boolean
$_cacheable= 'true'
true
Details- Type
- boolean
- Inherited_from
- \modTag::$$_cacheable
array
$_fields= 'array(
'name' => '',
'properties' => ''
)'
array(
'name' => '',
'properties' => ''
)
Details- Type
- array
- Inherited_from
- \modTag::$$_fields
array
$_filters= 'array('input' => null, 'output' => null)'
array('input' => null, 'output' => null)
Details- Type
- array
- Inherited_from
- \modTag::$$_filters
boolean
$_processed= 'false'
false
Details- Type
- boolean
- Inherited_from
- \modTag::$$_processed
array
$_properties= 'array()'
array()
Details- Type
- array
- Inherited_from
- \modTag::$$_properties
string
$_propertyString= ''''
Just the isolated properties part of the tag string
Inherited from: \modTag::$$_propertyString''
Details- Type
- string
- Inherited_from
- \modTag::$$_propertyString
Methods
__construct(
\modX $modx
)
:
void
Overrides modTag::__construct to set the Field Tag token Set a reference to the modX object, load the name and properties, and instantiate the tag class instance.
Name | Type | Description |
---|---|---|
$modx | \modX | A reference to the modX object |
filterInput(
)
:
void
This is called by default in {@link modTag::process()} after the tag properties have been parsed.
filterOutput(
)
:
void
Call this method in your {modTag::process()} implementation when it is appropriate, typically once all processing has been completed, but before any caching takes place.
get(
string $k
)
:
mixed
Name | Type | Description |
---|---|---|
$k | string | The field key. |
Type | Description |
---|---|
mixed | The value of the field or null if it is not set. |
getContent(
array $options
=
array()
)
:
string
Get the raw source content of the field.
Name | Type | Description |
---|---|---|
$options | array | An array of options implementations can use to accept language, revision identifiers, or other information to alter the behavior of the method. |
Type | Description |
---|---|
string | The raw source content for the element. |
getInputFilter(
)
:
\modInputFilter | null
Get an input filter instance configured for this Element.
Inherited from: \modTag::getInputFilter()Type | Description |
---|---|
\modInputFilter | null | An input filter instance (or null if one cannot be loaded). |
getOutputFilter(
)
:
\modOutputFilter | null
Get an output filter instance configured for this Element.
Inherited from: \modTag::getOutputFilter()Type | Description |
---|---|
\modOutputFilter | null | An output filter instance (or null if one cannot be loaded). |
getProperties(
array | string $properties
=
null
)
:
array
Get the properties for this element instance for processing.
Inherited from: \modTag::getProperties()Name | Type | Description |
---|---|---|
$properties | array | string | An array or string of properties to apply. |
Type | Description |
---|---|
array | A simple array of properties ready to use for processing. |
getPropertySet(
string | null $setName
=
null
)
:
array | null
Gets a named property set to use with this modTag instance.
Inherited from: \modTag::getPropertySet()This function will attempt to extract a setName from the tag name using the @ symbol to delimit the name of the property set. If a setName parameter is provided, the function will override any property set specified in the name by merging both property sets.
Here is an example of an tag using the @ modifier to specify a property set name:
[[~TagName@PropertySetName:FilterCommand=FilterModifier
?
&PropertyKey1=PropertyValue1
&PropertyKey2=PropertyValue2
]]
Name | Type | Description |
---|---|---|
$setName | string | null | An explicit property set name to search for. |
Type | Description |
---|---|
array | null | An array of properties or null if no set is found. |
isCacheable(
)
:
boolean
Type | Description |
---|---|
boolean | True if the element can be stored to or retrieved from the element cache. |
process(
array | string $properties
=
null, string $content
=
null
)
:
mixed
Process the modFieldTag and return the output.
Name | Type | Description |
---|---|---|
$properties | array | string | An array of properties or a formatted property string. |
$content | string | Optional content to use for the element processing. |
Type | Description |
---|---|
mixed | The result of processing the tag. |
set(
string $k, mixed $v
)
:
void
Name | Type | Description |
---|---|---|
$k | string | The field key. |
$v | mixed | The value to assign to the field. |
setCacheable(
boolean $cacheable
=
true
)
:
void
Name | Type | Description |
---|---|---|
$cacheable | boolean | Indicates the value to set for cacheability of this element. |
setContent(
string $content, array $options
=
array()
)
:
boolean
Name | Type | Description |
---|---|---|
$content | string | The content to set |
$options | array | Ignored. |
Type | Description |
---|---|
boolean |
setProperties(
array | string $properties, boolean $merge
=
false
)
:
boolean
Name | Type | Description |
---|---|---|
$properties | array | string | A property array or property string. |
$merge | boolean | Indicates if properties should be merged with existing ones. |
Type | Description |
---|---|
boolean | true if the properties are set. |
setTag(
string $tag
)
:
void
Name | Type | Description |
---|---|---|
$tag | string | The tag to use for this element. |
\modLexiconTag
Represents Lexicon tags, for localized strings.
[[%word_or_phase]] Returns the lexicon representation of 'word_or_phrase' for the currently loaded language.
- Parent(s)
- \modTag
Properties
boolean
$_cacheable= 'true'
true
Details- Type
- boolean
- Inherited_from
- \modTag::$$_cacheable
array
$_fields= 'array(
'name' => '',
'properties' => ''
)'
array(
'name' => '',
'properties' => ''
)
Details- Type
- array
- Inherited_from
- \modTag::$$_fields
array
$_filters= 'array('input' => null, 'output' => null)'
array('input' => null, 'output' => null)
Details- Type
- array
- Inherited_from
- \modTag::$$_filters
boolean
$_processed= 'false'
false
Details- Type
- boolean
- Inherited_from
- \modTag::$$_processed
array
$_properties= 'array()'
array()
Details- Type
- array
- Inherited_from
- \modTag::$$_properties
string
$_propertyString= ''''
Just the isolated properties part of the tag string
Inherited from: \modTag::$$_propertyString''
Details- Type
- string
- Inherited_from
- \modTag::$$_propertyString
Methods
__construct(
\modX $modx
)
:
void
Overrides modTag::__construct to set the Lexicon Tag token Set a reference to the modX object, load the name and properties, and instantiate the tag class instance.
Name | Type | Description |
---|---|---|
$modx | \modX | A reference to the modX object |
filterInput(
)
:
void
This is called by default in {@link modTag::process()} after the tag properties have been parsed.
filterOutput(
)
:
void
Call this method in your {modTag::process()} implementation when it is appropriate, typically once all processing has been completed, but before any caching takes place.
get(
string $k
)
:
mixed
Name | Type | Description |
---|---|---|
$k | string | The field key. |
Type | Description |
---|---|
mixed | The value of the field or null if it is not set. |
getContent(
array $options
=
array()
)
:
string
Get the raw source content of the link.
Name | Type | Description |
---|---|---|
$options | array | An array of options implementations can use to accept language, revision identifiers, or other information to alter the behavior of the method. |
Type | Description |
---|---|
string | The raw source content for the element. |
getInputFilter(
)
:
\modInputFilter | null
Get an input filter instance configured for this Element.
Inherited from: \modTag::getInputFilter()Type | Description |
---|---|
\modInputFilter | null | An input filter instance (or null if one cannot be loaded). |
getOutputFilter(
)
:
\modOutputFilter | null
Get an output filter instance configured for this Element.
Inherited from: \modTag::getOutputFilter()Type | Description |
---|---|
\modOutputFilter | null | An output filter instance (or null if one cannot be loaded). |
getProperties(
array | string $properties
=
null
)
:
array
Get the properties for this element instance for processing.
Inherited from: \modTag::getProperties()Name | Type | Description |
---|---|---|
$properties | array | string | An array or string of properties to apply. |
Type | Description |
---|---|
array | A simple array of properties ready to use for processing. |
getPropertySet(
string | null $setName
=
null
)
:
array | null
Gets a named property set to use with this modTag instance.
Inherited from: \modTag::getPropertySet()This function will attempt to extract a setName from the tag name using the @ symbol to delimit the name of the property set. If a setName parameter is provided, the function will override any property set specified in the name by merging both property sets.
Here is an example of an tag using the @ modifier to specify a property set name:
[[~TagName@PropertySetName:FilterCommand=FilterModifier
?
&PropertyKey1=PropertyValue1
&PropertyKey2=PropertyValue2
]]
Name | Type | Description |
---|---|---|
$setName | string | null | An explicit property set name to search for. |
Type | Description |
---|---|
array | null | An array of properties or null if no set is found. |
isCacheable(
)
:
boolean
Type | Description |
---|---|
boolean | True if the element can be stored to or retrieved from the element cache. |
process(
array | string $properties
=
null, string $content
=
null
)
:
mixed
Processes a modLexiconTag, recursively processing nested tags.
Name | Type | Description |
---|---|---|
$properties | array | string | An array of properties or a formatted property string. |
$content | string | Optional content to use for the element processing. |
Type | Description |
---|---|
mixed | The result of processing the tag. |
set(
string $k, mixed $v
)
:
void
Name | Type | Description |
---|---|---|
$k | string | The field key. |
$v | mixed | The value to assign to the field. |
setCacheable(
boolean $cacheable
=
true
)
:
void
Name | Type | Description |
---|---|---|
$cacheable | boolean | Indicates the value to set for cacheability of this element. |
setContent(
string $content, array $options
=
array()
)
:
boolean
Name | Type | Description |
---|---|---|
$content | string | The content to set |
$options | array | Ignored. |
Type | Description |
---|---|
boolean |
setProperties(
array | string $properties, boolean $merge
=
false
)
:
boolean
Name | Type | Description |
---|---|---|
$properties | array | string | A property array or property string. |
$merge | boolean | Indicates if properties should be merged with existing ones. |
Type | Description |
---|---|
boolean | true if the properties are set. |
setTag(
string $tag
)
:
void
Name | Type | Description |
---|---|---|
$tag | string | The tag to use for this element. |
\modLinkTag
Represents link tags.
[[~12]] Creates a URL from the specified resource identifier.
- Parent(s)
- \modTag
Properties
boolean
$_cacheable= 'true'
true
Details- Type
- boolean
- Inherited_from
- \modTag::$$_cacheable
array
$_fields= 'array(
'name' => '',
'properties' => ''
)'
array(
'name' => '',
'properties' => ''
)
Details- Type
- array
- Inherited_from
- \modTag::$$_fields
array
$_filters= 'array('input' => null, 'output' => null)'
array('input' => null, 'output' => null)
Details- Type
- array
- Inherited_from
- \modTag::$$_filters
boolean
$_processed= 'false'
false
Details- Type
- boolean
- Inherited_from
- \modTag::$$_processed
array
$_properties= 'array()'
array()
Details- Type
- array
- Inherited_from
- \modTag::$$_properties
string
$_propertyString= ''''
Just the isolated properties part of the tag string
Inherited from: \modTag::$$_propertyString''
Details- Type
- string
- Inherited_from
- \modTag::$$_propertyString
Methods
__construct(
\modX $modx
)
:
void
Set a reference to the modX object, load the name and properties, and instantiate the tag class instance.
Inherited from: \modTag::__construct()Name | Type | Description |
---|---|---|
$modx | \modX | A reference to the modX object |
__constructor(
$modx
)
:
void
Overrides modTag::__construct to set the Link Tag token {@inheritdoc}
Name | Type | Description |
---|---|---|
$modx |
filterInput(
)
:
void
This is called by default in {@link modTag::process()} after the tag properties have been parsed.
filterOutput(
)
:
void
Call this method in your {modTag::process()} implementation when it is appropriate, typically once all processing has been completed, but before any caching takes place.
get(
string $k
)
:
mixed
Name | Type | Description |
---|---|---|
$k | string | The field key. |
Type | Description |
---|---|
mixed | The value of the field or null if it is not set. |
getContent(
array $options
=
array()
)
:
string
Name | Type | Description |
---|---|---|
$options | array | An array of options implementations can use to accept language, revision identifiers, or other information to alter the behavior of the method. |
Type | Description |
---|---|
string | The raw source content for the element. |
getInputFilter(
)
:
\modInputFilter | null
Get an input filter instance configured for this Element.
Inherited from: \modTag::getInputFilter()Type | Description |
---|---|
\modInputFilter | null | An input filter instance (or null if one cannot be loaded). |
getOutputFilter(
)
:
\modOutputFilter | null
Get an output filter instance configured for this Element.
Inherited from: \modTag::getOutputFilter()Type | Description |
---|---|
\modOutputFilter | null | An output filter instance (or null if one cannot be loaded). |
getProperties(
array | string $properties
=
null
)
:
array
Get the properties for this element instance for processing.
Inherited from: \modTag::getProperties()Name | Type | Description |
---|---|---|
$properties | array | string | An array or string of properties to apply. |
Type | Description |
---|---|
array | A simple array of properties ready to use for processing. |
getPropertySet(
string | null $setName
=
null
)
:
array | null
Gets a named property set to use with this modTag instance.
Inherited from: \modTag::getPropertySet()This function will attempt to extract a setName from the tag name using the @ symbol to delimit the name of the property set. If a setName parameter is provided, the function will override any property set specified in the name by merging both property sets.
Here is an example of an tag using the @ modifier to specify a property set name:
[[~TagName@PropertySetName:FilterCommand=FilterModifier
?
&PropertyKey1=PropertyValue1
&PropertyKey2=PropertyValue2
]]
Name | Type | Description |
---|---|---|
$setName | string | null | An explicit property set name to search for. |
Type | Description |
---|---|
array | null | An array of properties or null if no set is found. |
isCacheable(
)
:
boolean
Type | Description |
---|---|
boolean | True if the element can be stored to or retrieved from the element cache. |
process(
array | string $properties
=
null, string $content
=
null
)
:
mixed
Processes the modLinkTag, recursively processing nested tags.
Name | Type | Description |
---|---|---|
$properties | array | string | An array of properties or a formatted property string. |
$content | string | Optional content to use for the element processing. |
Type | Description |
---|---|
mixed | The result of processing the tag. |
set(
string $k, mixed $v
)
:
void
Name | Type | Description |
---|---|---|
$k | string | The field key. |
$v | mixed | The value to assign to the field. |
setCacheable(
boolean $cacheable
=
true
)
:
void
Name | Type | Description |
---|---|---|
$cacheable | boolean | Indicates the value to set for cacheability of this element. |
setContent(
string $content, array $options
=
array()
)
:
boolean
Name | Type | Description |
---|---|---|
$content | string | The content to set |
$options | array | Ignored. |
Type | Description |
---|---|
boolean |
setProperties(
array | string $properties, boolean $merge
=
false
)
:
boolean
Name | Type | Description |
---|---|---|
$properties | array | string | A property array or property string. |
$merge | boolean | Indicates if properties should be merged with existing ones. |
Type | Description |
---|---|
boolean | true if the properties are set. |
setTag(
string $tag
)
:
void
Name | Type | Description |
---|---|---|
$tag | string | The tag to use for this element. |
\modParser
Represents the MODX parser responsible for processing MODX tags.
This class encapsulates all of the functions for collecting and evaluating element tags embedded in text content.
- Children
- \modParser095
Properties
bool
$_processingTag= 'false'
If the parser is currently processing a tag
false
Details- Type
- bool
bool
$_processingUncacheable= 'false'
If the parser is currently processing an uncacheable tag
false
Details- Type
- bool
bool
$_removingUnprocessed= 'false'
If the parser is currently removing all unprocessed tags
false
Details- Type
- bool
Methods
_XType(
string $type
)
:
string
Converts legacy property string types to xtypes.
Name | Type | Description |
---|---|---|
$type | string | A property type string. |
Type | Description |
---|---|
string | A valid xtype. |
- Access
- protected
__construct(
\xPDO $modx
)
:
void
Name | Type | Description |
---|---|---|
$modx | \xPDO | A reference to the modX|xPDO instance |
collectElementTags(
string $origContent, array $matches, string $prefix
=
'[[', string $suffix
=
']]'
)
:
integer
Collects element tags in a string and injects them into an array.
Name | Type | Description |
---|---|---|
$origContent | string | The content to collect tags from. |
$matches | array | &$matches An array in which the collected tags will be stored (by reference) |
$prefix | string | The characters that define the start of a tag (default= "[["). |
$suffix | string | The characters that define the end of a tag (default= "]]"). |
Type | Description |
---|---|
integer | The number of tags collected from the content. |
getElement(
string $class, string $name
)
:
\modElement | null
Get a modElement instance taking advantage of the modX::$sourceCache.
Name | Type | Description |
---|---|---|
$class | string | The modElement derivative class to load. |
$name | string | An element name or raw tagName to identify the modElement instance. |
Type | Description |
---|---|
\modElement | null | An instance of the specified modElement derivative class. |
isProcessingTag(
)
:
bool
Returns true if the parser is currently processing a tag
Type | Description |
---|---|
bool |
isProcessingUncacheable(
)
:
bool
Returns true if the parser is currently processing an uncacheable tag
Type | Description |
---|---|
bool |
isRemovingUnprocessed(
)
:
bool
Returns true if the parser is currently removing any unprocessed tags
Type | Description |
---|---|
bool |
loadFromCache(
string $tag
)
:
string
Loads output cached by complete tag signature from the elementCache.
Name | Type | Description |
---|---|---|
$tag | string | The tag signature representing the element instance. |
Type | Description |
---|---|
string | The cached output from the element instance. |
mergeTagOutput(
array $tagMap, string $content
)
:
void
Merges processed tag output into provided content string.
Name | Type | Description |
---|---|---|
$tagMap | array | An array with full tags as keys and processed output as the values. |
$content | string | The content to merge the tag output with (passed by reference). |
parseProperties(
string $propSource
)
:
array
Parses an element/tag property string or array definition.
Name | Type | Description |
---|---|---|
$propSource | string | A valid property string or array source to parse. |
Type | Description |
---|---|
array | An associative array of property values parsed from the property string or array definition. |
parsePropertyString(
string $string, boolean $valuesOnly
=
false
)
:
array
Parses an element/tag property string and returns an array of properties.
Name | Type | Description |
---|---|---|
$string | string | The property string to parse. |
$valuesOnly | boolean | Indicates only the property value should be returned. |
Type | Description |
---|---|
array | The processed properties in array format |
processElementTags(
string $parentTag, string $content, boolean $processUncacheable
=
false, boolean $removeUnprocessed
=
false, string $prefix
=
"[[", string $suffix
=
"]]", array $tokens
=
array (), integer $depth
=
0
)
:
int
Collects and processes any set of tags as defined by a prefix and suffix.
Name | Type | Description |
---|---|---|
$parentTag | string | The tag representing the element processing this tag. Pass an empty string to allow parsing without this recursion check. |
$content | string | The content to process and act on (by reference). |
$processUncacheable | boolean | Determines if noncacheable tags are to be processed (default= false). |
$removeUnprocessed | boolean | Determines if unprocessed tags should be left in place in the content, or stripped out (default= false). |
$prefix | string | The characters that define the start of a tag (default= "[["). |
$suffix | string | The characters that define the end of a tag (default= "]]"). |
$tokens | array | Indicates that the parser should only process tags with the tokens included in this array. |
$depth | integer | The maximum iterations to recursively process tags returned by prior passes, 0 by default. |
Type | Description |
---|---|
int | The number of processed tags |
processTag(
string $tag, boolean $processUncacheable
=
true
)
:
mixed
Processes a modElement tag and returns the result.
Name | Type | Description |
---|---|---|
$tag | string | A full tag string parsed from content. |
$processUncacheable | boolean |
Type | Description |
---|---|
mixed | The output of the processed element represented by the specified tag. |
\modPlaceholderTag
Represents placeholder tags.
[[+placeholder_key]] Represents a placeholder with name placeholder_key.
- Parent(s)
- \modTag
- Uses
- \modX::getPlaceholder()
Properties
boolean
$_cacheable= 'true'
true
Details- Type
- boolean
- Inherited_from
- \modTag::$$_cacheable
array
$_fields= 'array(
'name' => '',
'properties' => ''
)'
array(
'name' => '',
'properties' => ''
)
Details- Type
- array
- Inherited_from
- \modTag::$$_fields
array
$_filters= 'array('input' => null, 'output' => null)'
array('input' => null, 'output' => null)
Details- Type
- array
- Inherited_from
- \modTag::$$_filters
boolean
$_processed= 'false'
false
Details- Type
- boolean
- Inherited_from
- \modTag::$$_processed
array
$_properties= 'array()'
array()
Details- Type
- array
- Inherited_from
- \modTag::$$_properties
string
$_propertyString= ''''
Just the isolated properties part of the tag string
Inherited from: \modTag::$$_propertyString''
Details- Type
- string
- Inherited_from
- \modTag::$$_propertyString
Methods
__construct(
\modX $modx
)
:
void
Overrides modTag::__construct to set the Placeholder Tag token Set a reference to the modX object, load the name and properties, and instantiate the tag class instance.
Name | Type | Description |
---|---|---|
$modx | \modX | A reference to the modX object |
filterInput(
)
:
void
This is called by default in {@link modTag::process()} after the tag properties have been parsed.
filterOutput(
)
:
void
Call this method in your {modTag::process()} implementation when it is appropriate, typically once all processing has been completed, but before any caching takes place.
get(
string $k
)
:
mixed
Name | Type | Description |
---|---|---|
$k | string | The field key. |
Type | Description |
---|---|
mixed | The value of the field or null if it is not set. |
getContent(
array $options
=
array()
)
:
string
Get the raw source content of the field.
Name | Type | Description |
---|---|---|
$options | array | An array of options implementations can use to accept language, revision identifiers, or other information to alter the behavior of the method. |
Type | Description |
---|---|
string | The raw source content for the element. |
getInputFilter(
)
:
\modInputFilter | null
Get an input filter instance configured for this Element.
Inherited from: \modTag::getInputFilter()Type | Description |
---|---|
\modInputFilter | null | An input filter instance (or null if one cannot be loaded). |
getOutputFilter(
)
:
\modOutputFilter | null
Get an output filter instance configured for this Element.
Inherited from: \modTag::getOutputFilter()Type | Description |
---|---|
\modOutputFilter | null | An output filter instance (or null if one cannot be loaded). |
getProperties(
array | string $properties
=
null
)
:
array
Get the properties for this element instance for processing.
Inherited from: \modTag::getProperties()Name | Type | Description |
---|---|---|
$properties | array | string | An array or string of properties to apply. |
Type | Description |
---|---|
array | A simple array of properties ready to use for processing. |
getPropertySet(
string | null $setName
=
null
)
:
array | null
Gets a named property set to use with this modTag instance.
Inherited from: \modTag::getPropertySet()This function will attempt to extract a setName from the tag name using the @ symbol to delimit the name of the property set. If a setName parameter is provided, the function will override any property set specified in the name by merging both property sets.
Here is an example of an tag using the @ modifier to specify a property set name:
[[~TagName@PropertySetName:FilterCommand=FilterModifier
?
&PropertyKey1=PropertyValue1
&PropertyKey2=PropertyValue2
]]
Name | Type | Description |
---|---|---|
$setName | string | null | An explicit property set name to search for. |
Type | Description |
---|---|
array | null | An array of properties or null if no set is found. |
isCacheable(
)
:
boolean
modPlaceholderTag instances cannot be cacheable.
Type | Description |
---|---|
boolean | Always returns false. |
process(
array | string $properties
=
null, string $content
=
null
)
:
mixed
Processes the modPlaceholderTag, recursively processing nested tags.
Tags in the properties of the tag itself, or the content returned by the tag element are processed. Non-cacheable nested tags are only processed if this tag element is also non-cacheable.
Name | Type | Description |
---|---|---|
$properties | array | string | An array of properties or a formatted property string. |
$content | string | Optional content to use for the element processing. |
Type | Description |
---|---|
mixed | The result of processing the tag. |
set(
string $k, mixed $v
)
:
void
Name | Type | Description |
---|---|---|
$k | string | The field key. |
$v | mixed | The value to assign to the field. |
setCacheable(
boolean $cacheable
=
true
)
:
void
modPlaceholderTag instances cannot be cacheable.
Name | Type | Description |
---|---|---|
$cacheable | boolean | Indicates the value to set for cacheability of this element. |
setContent(
string $content, array $options
=
array()
)
:
boolean
Name | Type | Description |
---|---|---|
$content | string | The content to set |
$options | array | Ignored. |
Type | Description |
---|---|
boolean |
setProperties(
array | string $properties, boolean $merge
=
false
)
:
boolean
Name | Type | Description |
---|---|---|
$properties | array | string | A property array or property string. |
$merge | boolean | Indicates if properties should be merged with existing ones. |
Type | Description |
---|---|
boolean | true if the properties are set. |
setTag(
string $tag
)
:
void
Name | Type | Description |
---|---|---|
$tag | string | The tag to use for this element. |
\modTag
Abstract class representing a pseudo-element that can be parsed.
- Children
- \modFieldTag
- \modPlaceholderTag
- \modLinkTag
- \modLexiconTag
- Abstract
- You must implement the process() method on derivatives to implement a parseable element tag. All element tags are identified by a unique single character token at the beginning of the tag string.
Properties
boolean
$_cacheable= 'true'
Whether or not this tag is marked as cacheable
true
Details- Type
- boolean
array
$_fields= 'array(
'name' => '',
'properties' => ''
)'
Fields on the tag
array(
'name' => '',
'properties' => ''
)
Details- Type
- array
array
$_filters= 'array('input' => null, 'output' => null)'
Any output/input filters on this tag
array('input' => null, 'output' => null)
Details- Type
- array
boolean
$_processed= 'false'
Whether or not the tag has been processed
false
Details- Type
- boolean
array
$_properties= 'array()'
The arranged properties array for this tag
array()
Details- Type
- array
string
$_propertyString= ''''
Just the isolated properties part of the tag string
''
Details- Type
- string
Methods
__construct(
\modX $modx
)
:
void
Set a reference to the modX object, load the name and properties, and instantiate the tag class instance.
Name | Type | Description |
---|---|---|
$modx | \modX | A reference to the modX object |
filterInput(
)
:
void
Apply an input filter to a tag.
This is called by default in {@link modTag::process()} after the tag properties have been parsed.
filterOutput(
)
:
void
Apply an output filter to a tag.
Call this method in your {modTag::process()} implementation when it is appropriate, typically once all processing has been completed, but before any caching takes place.
get(
string $k
)
:
mixed
Generic getter method for modTag attributes.
Name | Type | Description |
---|---|---|
$k | string | The field key. |
Type | Description |
---|---|
mixed | The value of the field or null if it is not set. |
getContent(
array $options
=
array()
)
:
string
Get the raw source content of the tag element.
Name | Type | Description |
---|---|---|
$options | array | An array of options implementations can use to accept language, revision identifiers, or other information to alter the behavior of the method. |
Type | Description |
---|---|
string | The raw source content for the element. |
getInputFilter(
)
:
\modInputFilter | null
Get an input filter instance configured for this Element.
Type | Description |
---|---|
\modInputFilter | null | An input filter instance (or null if one cannot be loaded). |
getOutputFilter(
)
:
\modOutputFilter | null
Get an output filter instance configured for this Element.
Type | Description |
---|---|
\modOutputFilter | null | An output filter instance (or null if one cannot be loaded). |
getProperties(
array | string $properties
=
null
)
:
array
Get the properties for this element instance for processing.
Name | Type | Description |
---|---|---|
$properties | array | string | An array or string of properties to apply. |
Type | Description |
---|---|
array | A simple array of properties ready to use for processing. |
getPropertySet(
string | null $setName
=
null
)
:
array | null
Gets a named property set to use with this modTag instance.
This function will attempt to extract a setName from the tag name using the @ symbol to delimit the name of the property set. If a setName parameter is provided, the function will override any property set specified in the name by merging both property sets.
Here is an example of an tag using the @ modifier to specify a property set name:
[[~TagName@PropertySetName:FilterCommand=FilterModifier
?
&PropertyKey1=PropertyValue1
&PropertyKey2=PropertyValue2
]]
Name | Type | Description |
---|---|---|
$setName | string | null | An explicit property set name to search for. |
Type | Description |
---|---|
array | null | An array of properties or null if no set is found. |
getToken(
)
:
string
Returns the current token for the tag
Type | Description |
---|---|
string | The token for the tag |
isCacheable(
)
:
boolean
Indicates if the element is cacheable.
Type | Description |
---|---|
boolean | True if the element can be stored to or retrieved from the element cache. |
process(
array | string $properties
=
null, string $content
=
null
)
:
mixed
Process the tag and return the result.
Name | Type | Description |
---|---|---|
$properties | array | string | An array of properties or a formatted property string. |
$content | string | Optional content to use for the element processing. |
Type | Description |
---|---|
mixed | The result of processing the tag. |
set(
string $k, mixed $v
)
:
void
Generic setter method for modTag attributes.
Name | Type | Description |
---|---|---|
$k | string | The field key. |
$v | mixed | The value to assign to the field. |
setCacheable(
boolean $cacheable
=
true
)
:
void
Sets the runtime cacheability of the element.
Name | Type | Description |
---|---|---|
$cacheable | boolean | Indicates the value to set for cacheability of this element. |
setContent(
string $content, array $options
=
array()
)
:
boolean
Set the raw source content for the tag element.
Name | Type | Description |
---|---|---|
$content | string | The content to set |
$options | array | Ignored. |
Type | Description |
---|---|
boolean |
setProperties(
array | string $properties, boolean $merge
=
false
)
:
boolean
Set default properties for this element instance.
Name | Type | Description |
---|---|---|
$properties | array | string | A property array or property string. |
$merge | boolean | Indicates if properties should be merged with existing ones. |
Type | Description |
---|---|
boolean | true if the properties are set. |
setTag(
string $tag
)
:
void
Setter method for the tag class var.
Name | Type | Description |
---|---|---|
$tag | string | The tag to use for this element. |