|
eZ Publish
[4.2]
|
Static Public Member Functions | |
| static | createAndPublishObject ($params) |
| Creates and publishes a new content object. | |
Definition at line 30 of file ezcontentfunctions.php.
| static eZContentFunctions::createAndPublishObject | ( | $ | params | ) | [static] |
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 <?php
// admin user $creatorID = 14;
// folder content class $classIdentifier = 'folder';
// root node $parentNodeID = 2;
// have a look at the folder content class' definition ;) // basically the array is the following : // key : attribute identifier ( not attribute ID !! ) // value : value for this attribute // // Please refer to each fromString/toString function to see // how to organize your data
$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' => 'A newly created folder object', 'short_name' => 'A new folder', 'short_description' => $xmlDeclaration .'<paragraph>This is the short description</paragraph></section>', 'description' => $xmlDeclaration . '<section><section><header>Some header</header><paragraph>Some paragraph with a <link target="_blank" url_id="1">link</link></paragraph> </section></section></section>', '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 }
?>
| array | $params | 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 :
|
Definition at line 107 of file ezcontentfunctions.php.
Referenced by eZSiteInstaller\createContentObject().