core/model/modx/processors/resource/update.class.php

Show: inherited
Table of Contents

Updates a resource.

Package
modx  
$pagetitle
string

The page title.

$content
string

The HTML content. Used in conjunction with $ta.

$template
integer

(optional) The modTemplate to use with this resource. Defaults to 0, or a blank template.

$parent
integer

(optional) The parent resource ID. Defaults to 0.

$class_key
string

(optional) The class key. Defaults to modDocument.

$menuindex
integer

(optional) The menu order. Defaults to 0.

$variablesmodified
string

(optional) A collection of modified TVs. Along with $tv1, $tv2, etc.

$context_key
string

(optional) The context in which this resource is located. Defaults to web.

$alias
string

(optional) The alias for FURLs that this resource is designated to.

$content_type
integer

(optional) The content type. Defaults to text/html.

$published
boolean

(optional) The published status.

$pub_date
string

(optional) The date on which this resource should become published.

$unpub_date
string

(optional) The date on which this resource should become unpublished.

$publishedon
string

(optional) The date this resource was published. Defaults to time()

$publishedby
integer

(optional) The modUser who published this resource. Defaults to the current user.

$resource_groups
\json

(optional) A JSON array of resource groups to assign this resource to.

$hidemenu
boolean

(optional) If true, The resource will not show up in menu builders.

$isfolder
boolean

(optional) Whether or not the resource is a container of resources.

$richtext
boolean

(optional) If true, MODX will render the available RTE for editing this resource.

$donthit
boolean

(optional) (deprecated) If true, MODX will not log visits on this resource.

$cacheable
boolean

(optional) If false, the resource will not be cached.

$searchable
boolean

(optional) If false, the resource will not appear in searches.

$syncsite
boolean

(optional) If false, will not empty the cache on save.

array
Subpackage
processors.resource  

\modResourceUpdateProcessor

Package: modx\processors\resource

Updates a resource.

{@inheritdoc}

Parent(s)
\modObjectUpdateProcessor < \modObjectProcessor < \modProcessor
Children
\modResourceUpdateFromGridProcessor
$pagetitle
string

The page title.

$content
string

The HTML content. Used in conjunction with $ta.

$template
integer

(optional) The modTemplate to use with this resource. Defaults to 0, or a blank template.

$parent
integer

(optional) The parent resource ID. Defaults to 0.

$class_key
string

(optional) The class key. Defaults to modDocument.

$menuindex
integer

(optional) The menu order. Defaults to 0.

$variablesmodified
string

(optional) A collection of modified TVs. Along with $tv1, $tv2, etc.

$context_key
string

(optional) The context in which this resource is located. Defaults to web.

$alias
string

(optional) The alias for FURLs that this resource is designated to.

$content_type
integer

(optional) The content type. Defaults to text/html.

$published
boolean

(optional) The published status.

$pub_date
string

(optional) The date on which this resource should become published.

$unpub_date
string

(optional) The date on which this resource should become unpublished.

$publishedon
string

(optional) The date this resource was published. Defaults to time()

$publishedby
integer

(optional) The modUser who published this resource. Defaults to the current user.

$resource_groups
\json

(optional) A JSON array of resource groups to assign this resource to.

$hidemenu
boolean

(optional) If true, The resource will not show up in menu builders.

$isfolder
boolean

(optional) Whether or not the resource is a container of resources.

$richtext
boolean

(optional) If true, MODX will render the available RTE for editing this resource.

$donthit
boolean

(optional) (deprecated) If true, MODX will not log visits on this resource.

$cacheable
boolean

(optional) If false, the resource will not be cached.

$searchable
boolean

(optional) If false, the resource will not appear in searches.

$syncsite
boolean

(optional) If false, will not empty the cache on save.

array

Properties

Propertypublicstring  $afterSaveEvent= ''OnDocFormSave''
The name of the event to fire after saving

Default value'OnDocFormSave'Details
Type
string
Propertypublicstring  $beforeSaveEvent= ''OnBeforeDocFormSave''
The name of the event to fire before saving

Default value'OnBeforeDocFormSave'Details
Type
string
Propertypublic  $checkSavePermission= 'true'
Default valuetrueDetails
Type
n/a
Inherited_from
\modObjectUpdateProcessor::$$checkSavePermission  
Propertypublicstring  $classKey= ''modResource''
The class key of the Object to iterate

Default value'modResource'Details
Type
string
Propertypublicboolean  $isSiteStart= 'false'

Default valuefalseDetails
Type
boolean
Propertypublicarray  $languageTopics= 'array('resource')'
An array of language topics to load

Default valuearray('resource')Details
Type
array
Propertypublic\modUser  $lockedUser= ''

Details
Type
\modUser
Propertypublic\modX  $modx= 'null'
inherited

A reference to the modX object.

Inherited from: \modProcessor::$$modx\modObjectProcessor::$$modx\modObjectUpdateProcessor::$$modx
Default valuenullDetails
Type
\modX
Inherited_from
\modProcessor::$$modx  
Inherited_from
\modObjectProcessor::$$modx  
Inherited_from
\modObjectUpdateProcessor::$$modx  
Propertypublic\modResource  $newParent= ''

Details
Type
\modResource
Propertypublic\modResource  $object= ''

Details
Type
\modResource
Propertypublicstring  $objectType= ''resource''
The object "type", this will be used in various lexicon error strings

Default value'resource'Details
Type
string
Propertypublic\modContext  $oldContext= ''

Details
Type
\modContext
Propertypublic\modResource  $oldParent= ''

Details
Type
\modResource
Propertypublic\modResource  $parentResource= ''

Details
Type
\modResource
Propertypublicstring  $path= ''''
inherited

The absolute path to this processor

Inherited from: \modProcessor::$$path\modObjectProcessor::$$path\modObjectUpdateProcessor::$$path
Default value''Details
Type
string
Inherited_from
\modProcessor::$$path  
Inherited_from
\modObjectProcessor::$$path  
Inherited_from
\modObjectUpdateProcessor::$$path  
Propertypublicstring  $permission= ''save_document''
The Permission to use when checking against

Default value'save_document'Details
Type
string
Propertypublicstring  $primaryKeyField= ''id''
inheritedThe primary key field to grab the object by

Inherited from: \modObjectProcessor::$$primaryKeyField\modObjectUpdateProcessor::$$primaryKeyField
Default value'id'Details
Type
string
Inherited_from
\modObjectProcessor::$$primaryKeyField  
Inherited_from
\modObjectUpdateProcessor::$$primaryKeyField  
Propertypublicarray  $properties= 'array()'
inherited

The array of properties being passed to this processor

Inherited from: \modProcessor::$$properties\modObjectProcessor::$$properties\modObjectUpdateProcessor::$$properties
Default valuearray()Details
Type
array
Inherited_from
\modProcessor::$$properties  
Inherited_from
\modObjectProcessor::$$properties  
Inherited_from
\modObjectUpdateProcessor::$$properties  
Propertypublicstring  $resourceClass= ''

Details
Type
string
Propertypublicboolean  $resourceDeleted= 'false'

Default valuefalseDetails
Type
boolean
Propertypublicboolean  $resourceUnDeleted= 'false'

Default valuefalseDetails
Type
boolean
Propertypublic\modTemplate  $template= ''

Details
Type
\modTemplate
Propertypublic\modContext  $workingContext= ''

Details
Type
\modContext

Methods

methodpublic__construct( \modX $modx, array $properties = array() ) : void
Parameters
Name Type Description
$modx \modX

A reference to the modX instance

$properties array

An array of properties

methodprotected_decodeLiterals( string $string ) : string
inherited

Decodes strings encoded by _encodeLiterals to restore JavaScript literals.

Inherited from: \modProcessor::_decodeLiterals()\modObjectProcessor::_decodeLiterals()\modObjectUpdateProcessor::_decodeLiterals()
Parameters
Name Type Description
$string string

The JSON-encoded string with encoded literals.

Returns
Type Description
string The JSON-encoded string with literals restored.
Details
Access
protected  
methodprotected_encodeLiterals( mixed $value, integer | string $key ) : void
inherited

Encodes certain JavaScript literal strings for later decoding.

Inherited from: \modProcessor::_encodeLiterals()\modObjectProcessor::_encodeLiterals()\modObjectUpdateProcessor::_encodeLiterals()
Parameters
Name Type Description
$value mixed

&$value A reference to the value to be encoded if it is identified as a literal.

$key integer | string

The array key corresponding to the value.

Details
Access
protected  
methodpublicaddFieldError( string $key, string $message = '' ) : mixed
Parameters
Name Type Description
$key string
$message string
Returns
Type Description
mixed
methodpublicaddLock( ) : boolean

Add a lock to the resource we are saving

Returns
Type Description
boolean
methodpublicafterSave( ) : boolean

Override in your derivative class to do functionality after save() is run

Returns
Type Description
boolean
methodpublicbeforeSave( ) : boolean

Override in your derivative class to do functionality before save() is run

Returns
Type Description
boolean
methodpublicbeforeSet( ) : boolean | string

Override in your derivative class to do functionality before the fields are set on the object

Returns
Type Description
boolean | string
methodpubliccheckContextOfChildren( ) : void

Reassign context for children if changed on main Resource

methodpubliccheckDeletedStatus( ) : boolean

Check deleted status and ensure user has permissions to delete resource

Returns
Type Description
boolean
methodpubliccheckForUnPublishOnSiteStart( ) : boolean

Check to prevent unpublishing of site_start

Returns
Type Description
boolean
methodpubliccheckFriendlyAlias( ) : mixed | string

Friendly URL alias checks

Returns
Type Description
mixed | string
methodpubliccheckParentContext( ) : mixed

If parent is changed, set context to new parent's context

Returns
Type Description
mixed
methodpubliccheckPermissions( ) : boolean
inherited

Return true here to allow access to this processor.

Inherited from: \modObjectProcessor::checkPermissions()\modObjectUpdateProcessor::checkPermissions()
Returns
Type Description
boolean
methodpubliccheckPublishedOn( ) : int

Set publishedon date if publish change is different

Returns
Type Description
int
methodpubliccheckPublishingPermissions( ) : boolean

Deny publishing if the user does not have access to

Returns
Type Description
boolean
methodpubliccleanup( ) : array

Cleanup the processor and return the resulting object

Returns
Type Description
array
methodpublicclearCache( ) : void

Empty site cache if specified to do so

methodpublicfailure( string $msg = '', mixed $object = null ) : array | string
inherited

Return a failure message from the processor.

Inherited from: \modProcessor::failure()\modObjectProcessor::failure()\modObjectUpdateProcessor::failure()
Parameters
Name Type Description
$msg string
$object mixed
Returns
Type Description
array | string
methodpublicfireAfterSaveEvent( ) : void
inherited

Fire the after save event

Inherited from: \modObjectUpdateProcessor::fireAfterSaveEvent()
methodpublicfireBeforeSaveEvent( ) : boolean
inherited

Fire before save event. Return true to prevent saving.

Inherited from: \modObjectUpdateProcessor::fireBeforeSaveEvent()
Returns
Type Description
boolean
methodpublicfireDeleteEvent( ) : null

Fire Delete event if resource was deleted

Returns
Type Description
null
methodpublicfireUnDeleteEvent( ) : mixed

Fire UnDelete event if resource was undeleted

Returns
Type Description
mixed
methodpublicfixParents( ) : void

Set the parents isfolder status based upon remaining children

Details
TODO
Debate whether or not this should be default functionality  
methodpublicgetInstance( \modX $modx, string $className, array $properties = array() ) : \modProcessor
static

Allow for Resources to use derivative classes for their processors

Parameters
Name Type Description
$modx \modX
$className string
$properties array
Returns
Type Description
\modProcessor
Details
Static
 
methodpublicgetLanguageTopics( ) : array
inherited

Load a collection of Language Topics for this processor.

Inherited from: \modObjectProcessor::getLanguageTopics()\modObjectUpdateProcessor::getLanguageTopics()

Override this in your derivative class to provide the array of topics to load.

Returns
Type Description
array
methodpublicgetProperties( ) : array
inherited

Get an array of properties for this processor

Inherited from: \modProcessor::getProperties()\modObjectProcessor::getProperties()\modObjectUpdateProcessor::getProperties()
Returns
Type Description
array
methodpublicgetProperty( string $k, mixed $default = null ) : mixed
Parameters
Name Type Description
$k string
$default mixed
Returns
Type Description
mixed
methodpublichandleCheckBoxes( ) : void

Handle formatting of various checkbox fields

methodpublichandleParent( ) : int | mixed

Handle the parent field, checking for veracity

Returns
Type Description
int | mixed
methodpublichasErrors( ) : boolean
inherited

Return whether or not the processor has errors

Inherited from: \modProcessor::hasErrors()\modObjectProcessor::hasErrors()\modObjectUpdateProcessor::hasErrors()
Returns
Type Description
boolean
methodpublicinitialize( ) : boolean
inherited

Can be used to provide custom methods prior to processing. Return true to tell MODX that the Processor initialized successfully. If you return anything else, MODX will output that return value as an error message.

Inherited from: \modObjectUpdateProcessor::initialize()
Returns
Type Description
boolean
methodpubliclogManagerAction( ) : void
inherited

Log the removal manager action

Inherited from: \modObjectUpdateProcessor::logManagerAction()
methodpublicoutputArray( array $array, mixed $count = false ) : string
inherited

Return arrays of objects (with count) converted to JSON.

Inherited from: \modProcessor::outputArray()\modObjectProcessor::outputArray()\modObjectUpdateProcessor::outputArray()

The JSON result includes two main elements, total and results. This format is used for list results.

Parameters
Name Type Description
$array array

An array of data objects.

$count mixed

The total number of objects. Used for pagination.

Returns
Type Description
string The JSON output.
Details
Access
public  
methodpublicprocess( ) : mixed
inherited

Run the processor and return the result. Override this in your derivative class to provide custom functionality.

Inherited from: \modObjectUpdateProcessor::process()

Used here for pre-2.2-style processors.

Returns
Type Description
mixed
methodpublicprocessEventResponse( array | string $response, string $separator = "\n" ) : string
Parameters
Name Type Description
$response array | string

The response generated by the invokeEvent call

$separator string

The separator for each event response

Returns
Type Description
string The processed response.
methodpublicrun( ) : \modProcessorResponse
inherited

Run the processor, returning a modProcessorResponse object.

Inherited from: \modProcessor::run()\modObjectProcessor::run()\modObjectUpdateProcessor::run()
Returns
Type Description
\modProcessorResponse
methodpublicsaveObject( ) : boolean
inherited

Abstract the saving of the object out to allow for transient and non-persistent object updating in derivative classes

Inherited from: \modObjectUpdateProcessor::saveObject()
Returns
Type Description
boolean
methodpublicsaveTemplateVariables( ) : array | mixed

Set any Template Variables passed to the Resource. You must pass "tvs" as 1 or true to initiate these checks.

Returns
Type Description
array | mixed
methodpublicsetCheckbox( string $k, boolean $force = false ) : int | null
inherited

Special helper method for handling checkboxes. Only set value if passed or $force is true, and check for a not empty value or string 'false'.

Inherited from: \modProcessor::setCheckbox()\modObjectProcessor::setCheckbox()\modObjectUpdateProcessor::setCheckbox()
Parameters
Name Type Description
$k string
$force boolean
Returns
Type Description
int | null
methodpublicsetDefaultProperties( array $properties = array() ) : array
inherited

Sets default properties that only are set if they don't already exist in the request

Inherited from: \modProcessor::setDefaultProperties()\modObjectProcessor::setDefaultProperties()\modObjectUpdateProcessor::setDefaultProperties()
Parameters
Name Type Description
$properties array
Returns
Type Description
array The newly merged properties array
methodpublicsetPath( string $path ) : void
Parameters
Name Type Description
$path string

The absolute path

methodpublicsetProperties( array $properties ) : void
inherited

Set the runtime properties for the processor

Inherited from: \modProcessor::setProperties()\modObjectProcessor::setProperties()\modObjectUpdateProcessor::setProperties()
Parameters
Name Type Description
$properties array

The properties, in array and key-value form, to run on this processor

methodpublicsetProperty( string $k, mixed $v ) : void
Parameters
Name Type Description
$k string
$v mixed
methodpublicsetPublishDate( ) : int

Format the pub_date if it is set and adjust contingencies

Returns
Type Description
int
methodpublicsetResourceGroups( ) : mixed

If specified, set the Resource Groups attached to the Resource

Returns
Type Description
mixed
methodpublicsetUnPublishDate( ) : int | mixed

Format the unpub_date if it is set and adjust contingencies

Returns
Type Description
int | mixed
methodpublicsuccess( string $msg = '', mixed $object = null ) : array | string
inherited

Return a success message from the processor.

Inherited from: \modProcessor::success()\modObjectProcessor::success()\modObjectUpdateProcessor::success()
Parameters
Name Type Description
$msg string
$object mixed
Returns
Type Description
array | string
methodpublictoJSON( mixed $data ) : string
inherited

Converts PHP to JSON with JavaScript literals left in-tact.

Inherited from: \modProcessor::toJSON()\modObjectProcessor::toJSON()\modObjectUpdateProcessor::toJSON()

JSON does not allow JavaScript literals, but this function encodes certain identifiable literals and decodes them back into literals after modX::toJSON() formats the data.

Parameters
Name Type Description
$data mixed

The PHP data to be converted.

Returns
Type Description
string The extended JSON-encoded string.
Details
Access
public  
methodpublictrimPageTitle( ) : string

Trim the page title

Returns
Type Description
string
methodpublicunsetProperty( string $key ) : void
inherited

Completely unset a property from the properties array

Inherited from: \modProcessor::unsetProperty()\modObjectProcessor::unsetProperty()\modObjectUpdateProcessor::unsetProperty()
Parameters
Name Type Description
$key string
Documentation was generated by DocBlox 0.18.1.