kernel/classes/ezcontentfunctions.php
File containing the eZContentFunctions class.
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Package
- kernel
- Version
- 4.6.0
\eZContentFunctions
File containing the eZContentFunctions class.
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
- eZ Business Use License Agreement Version 2.0
- Version
- 4.6.0
Methods


createAndPublishObject(
array $params
)
:
\eZContentObject | false
Creates and publishes a new content object.
This function takes all the variables passes in the $params argument and creates a new content object out of it.
Here is an example
';
$attributeList = array( 'name' => 'A newly created folder object',
'short_name' => 'A new folder',
'short_description' => $xmlDeclaration .'This is the short description ',
'description' => $xmlDeclaration . 'Some header Some paragraph
with a link
',
'show_children' => true);
// Creates the data import array
$params = array();
$params['creator_id'] = $creatorID;
$params['class_identifier'] = $classIdentifier;
$params['parent_node_id'] = $parentNodeID;
$params['attributes'] = $attributeList;
$contentObject = eZContentFunctions::createAndPublishObject( $params );
if( $contentObject )
{
// do anything you want here
}
?>
Name | Type | Description |
---|---|---|
$params | array | An array with all the informations to store. This array must contains a strict list of key/value pairs. The possible keys are the following : - 'parent_node_id' : The parentNodeID for this new object. - 'class_identifier' : The classIdentifier for this new object. using the classID is not possible. - 'creator_id' : The eZUser::contentObjectID to use as creator of this new eZContentObject, uses current user and stores object id in current session if not set - 'attributes' : The list of attributes to store, in order to now which values you can use for this key, you have to read the code of the fromString and toString functions of the attribute's datatype you use - 'storage_dir' : - 'remote_id' : The value for the remoteID (optional) - 'section_id' : The value for the sectionID (optional) |
Type | Description |
---|---|
\eZContentObject | false | An eZContentObject object if success, false otherwise |


updateAndPublishObject(
\eZContentObject $object, array $params
)
:
bool
Updates an existing content object.
This function works like createAndPublishObject
Here is an example
';
$now = $now = date( 'Y/m/d H:i:s', time() );
$xmlDeclaration = '
';
$attributeList = array( 'name' => 'Name ' . $now,
'short_name' => 'Short name ' . $now,
'short_description' => $xmlDeclaration . 'Short description '. $now . ' ',
'description' => $xmlDeclaration . 'Description '. $now . ' ',
'show_children' => false);
$params = array();
$params['attributes'] = $attributeList;
// $params['remote_id'] = $now;
// $params['section_id'] = 3;
// $params['language'] = 'ger-DE';
$result = eZContentFunctions::updateAndPublishObject( $contentObject, $params );
if( $result )
print( 'Update OK' );
else
print( 'Failed' );
}
?>
Name | Type | Description |
---|---|---|
$object | \eZContentObject | an eZContentObject object |
$params | array | an array with the attributes to update |
Type | Description |
---|---|
bool | true if the object has been successfully updated, false otherwise |
- Static