model/modx/modcontext.class.php

Classes 
package
modx
Classes
modContext

Description

modContext

\modContext

Extends from
\modAccessibleObject
package
modx
Properties
$_cacheKey
$aliasMap
$config
$eventMap
$pluginCache
$resourceMap
Methods
findPolicy
getCacheKey
getOption
makeUrl
prepare
remove
save

Description

Represents a virtual site context within a modX repository.

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

$_cacheKey

string $_cacheKey = '[contextKey]/context'

The cache filename for the resource in the context.

Details

string
visibility
protected
default
[contextKey]/context
final
false
static
false

$aliasMap

 $aliasMap = 'null'

Details

visibility
public
default
null
final
false
static
false

$config

 $config = 'null'

Details

visibility
public
default
null
final
false
static
false

$eventMap

 $eventMap = 'null'

Details

visibility
public
default
null
final
false
static
false

$pluginCache

 $pluginCache = 'null'

Details

visibility
public
default
null
final
false
static
false

$resourceMap

 $resourceMap = 'null'

Details

visibility
public
default
null
final
false
static
false

Methods

findPolicy

findPolicy( string $context ) : array

Loads the access control policies applicable to this element.

{@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

getCacheKey

getCacheKey( ) : string

Returns the file name representing this context in the cache.

Output
string
The cache filename.
Details
visibility
public
final
false
static
false
access
public

getOption

getOption( string $key, string $default = null, array $options = null ) : mixed

Returns a context-specific setting value.

Arguments
$key
string
The option key to check.
$default
string
A default value to use if not found.
$options
array
An array of additional options to merge over top of the context settings.
Output
mixed
The option value or the provided default.
Details
visibility
public
final
false
static
false

makeUrl

makeUrl( integer $id, string $args, mixed $scheme ) : string

Generates a URL representing a specified resource in this context.

Note that if this method is called from a context other than the one initialized for the modX instance, and the scheme is not specified, an empty string, or abs, the method will force the scheme to full.

Arguments
$id
integer
The id of a resource.
$args
string
A query string to append to the generated URL.
$scheme
mixed
The scheme indicates in what format the URL is generated.<br> <pre> -1 : (default value) URL is relative to site_url 0 : see http 1 : see https full : URL is absolute, prepended with site_url from config abs : URL is absolute, prepended with base_url from config http : URL is absolute, forced to http scheme https : URL is absolute, forced to https scheme </pre>
Output
string
The URL for the resource.
Details
visibility
public
final
false
static
false
access
public

prepare

prepare( boolean $regenerate = false ) : boolean

Prepare a context for use.

Arguments
$regenerate
boolean
If true, the existing cache file will be ignored and regenerated.
Output
boolean
Indicates if the context was successfully prepared.
Details
visibility
public
final
false
static
false
access
public
uses
modCacheManager::generateContext() This method is responsible for preparing the context for use. {@internal You can override this behavior here, but you will only need to override the modCacheManager::generateContext() method in most cases}}

remove

remove( array $ancestors = array ) : boolean

Overrides xPDOObject::remove to 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
Documentation was generated by DocBlox 0.11.2.