eZ Publish Community Project (Legacy Stack) 2013.4
Class

eZContentFunctions

class eZContentFunctions

File containing the eZContentFunctions class.

Methods

static  updateAndPublishObject(eZContentObject $object, array $params)

Updates an existing content object.

Details

at line 227
static public updateAndPublishObject(eZContentObject $object, array $params)

Updates an existing content object.

This function works like createAndPublishObject

Here is an example

<?php $contentObjectID = 1; $contentObject = eZContentObject::fetch( $contentObjectID );

if( $contentObject instanceof eZContentObject ) { $xmlDeclaration = '

';

$now = $now = date( 'Y/m/d H:i:s', time() );
$xmlDeclaration = '<?xml version="1.0" encoding="utf-8"?>
                <section xmlns:image="http://ez.no/namespaces/ezpublish3/image/"
                            xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"
                            xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">';

$attributeList = array( 'name'              => 'Name ' . $now,
                        'short_name'        => 'Short name ' . $now,
                        'short_description' => $xmlDeclaration . '<paragraph>Short description '. $now . '</paragraph></section>',
                        'description'       => $xmlDeclaration . '<paragraph>Description '. $now . '</paragraph></section>',
                        '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' );

} ?>

Parameters

eZContentObject $object an eZContentObject object
array $params an array with the attributes to update