Permalink
Browse files

sort array handling in createcontent handler

  • Loading branch information...
1 parent b841b44 commit d6d7027cffb69e6464840372aacf2522c372255c @bchoquet-heliopsis bchoquet-heliopsis committed May 19, 2011
Showing with 9 additions and 1 deletion.
  1. +9 −1 xmlinstallerhandler/ezcreatecontent.php
@@ -88,6 +88,8 @@ function proccessCreateContent( $xmlNode, $parentNodeID = false )
$objectInformation['ownerID'] = $objectNode->getAttribute( 'owner' );
$objectInformation['creatorID'] = $objectNode->getAttribute( 'creator' );
$objectInformation['attributes'] = array();
+ $objectInformation['sort_field'] = $objectNode->hasAttribute( 'sort_field' ) ? $objectNode->getAttribute( 'sort_field' ) : 'path';
+ $objectInformation['sort_order'] = $objectNode->hasAttribute( 'sort_order' ) ? $objectNode->getAttribute( 'sort_order' ) : 'asc';
switch( $priorityMode )
{
@@ -238,11 +240,17 @@ function createContentObject( $objectInformation )
{
$db->begin();
$versionNumber = $contentObjectVersion->attribute( 'version' );
+
+ $sortField = intval( eZContentObjectTreeNode::sortFieldID( $objectInformation['sort_field'] ) );
+ $sortOrder = strtolower( $objectInformation['sort_order'] ) == 'desc' ? eZContentObjectTreeNode::SORT_ORDER_DESC : eZContentObjectTreeNode::SORT_ORDER_ASC;
+
$nodeAssignment = eZNodeAssignment::create(
array( 'contentobject_id' => $contentObject->attribute( 'id' ),
'contentobject_version' => $versionNumber,
'parent_node' => $objectInformation['parentNode'],
- 'is_main' => 1
+ 'is_main' => 1,
+ 'sort_field' => $sortField,
+ 'sort_order' => $sortOrder,
)
);
$nodeAssignment->store();

0 comments on commit d6d7027

Please sign in to comment.