model/modx/modchunk.class.php
- package
- modx
- Classes
- modChunk
Description
Represents a chunk of static HTML content.
\modChunk
- Extends from
- \modElement
- package
- modx
- Methods
- __construct
- getContent
- process
- remove
- save
- setContent
Description
Represents a chunk of static HTML content.
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
Details
- visibility
- public
- final
- false
- static
- false
getContent
getContent(
array $options
=
array
)
:
string
Get the source content of this chunk.
Arguments
- $options
- array
Output
- string
- The source content.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public
process
process(
array|string $properties
=
null, string $content
=
null
)
:
mixed
Overrides modElement::process to initialize the Chunk into the element cache, as well as set placeholders and filter 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 and fire modX-specific events.
{@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
setContent
setContent(
string $content, array $options
=
array
)
:
string
Set the source content of this chunk.
Arguments
- $content
- string
- $options
- array
Output
- string
- True if successfully set
Details
- visibility
- public
- final
- false
- static
- false
- access
- public