model/modx/modcategory.class.php
- package
- modx
- Classes
- modCategory
Description
Represents a category for organizing modElement instances.
\modCategory
- Extends from
- \modAccessibleSimpleObject
- package
- modx
- Properties
- $_invalidCharacters
- $_parentChanged
- Methods
- buildClosure
- findPolicy
- rebuildClosure
- remove
- save
- set
Description
Represents a category for organizing modElement instances.
This is the basis for the entire xPDO object model, and can also be used by a class generator {@link xPDOGenerator}, ultimately allowing custom classes to be user-defined in a web interface and framework-generated at runtime.
Properties
$_invalidCharacters
array $_invalidCharacters = 'array'
Details
- array
A list of invalid characters in the name of an Element. - visibility
- protected
- default
- array
- final
- false
- static
- false
- access
- protected
$_parentChanged
boolean $_parentChanged = 'false'
Details
- boolean
Monitors whether parent has been changed. - visibility
- protected
- default
- false
- final
- false
- static
- false
- access
- protected
Methods
buildClosure
buildClosure(
)
:
boolean
Build the closure table for this instance.
Output
- boolean
- True unless building the closure fails and instance is removed.
Details
- visibility
- public
- final
- false
- static
- false
findPolicy
findPolicy(
string $context
)
:
array
Loads the access control policies applicable to this category.
{@inheritdoc}
Arguments
- $context
- string
A key identifying a specific context to use when searching for the applicable policies. If not provided, the current context is used.
Output
- array
- An array of access policies for this object; an empty array is returned if no policies are assigned to the object.
Details
- visibility
- public
- final
- false
- static
- false
rebuildClosure
rebuildClosure(
)
:
Rebuild closure table records for this instance, i.e. parent changed.
Details
- visibility
- public
- final
- false
- static
- false
remove
remove(
array $ancestors
=
array
)
:
boolean
Overrides xPDOObject::remove to reset all Element categories back to 0 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 xPDOObject::save to 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
set
set(
string $k, mixed $v
=
null, string|\callable $vType
)
:
boolean
Overrides xPDOObject::set to strip invalid characters from element names.
{@inheritDoc}
Arguments
- $k
- string
The field key or name. - $v
- mixed
The value to set the field to. - $vType
- string\callable
A string indicating the format of the provided value parameter, or a callable function that should be used to set the field value, overriding the default behavior.
Output
- boolean
- Determines whether the value was set successfully and was determined to be dirty (i.e. different from the previous value).
Details
- visibility
- public
- final
- false
- static
- false