Permalink
Browse files

Merge pull request #20 from seroman/patch-3

Setting section for new object (updated version with syntactic corrections)
  • Loading branch information...
2 parents cdd4162 + 0f8187f commit ee0b17bb59b2842cdce6d21466fdbabf667e0cc9 @andrerom andrerom committed Sep 19, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 modules/ezoe/upload.php
View
8 modules/ezoe/upload.php
@@ -121,6 +121,14 @@
$newObjectName = $newObject->attribute( 'name' );
$newObjectNodeID = (int) $newObject->attribute( 'main_node_id' ); // this will be empty if object is stopped by approve workflow
+ // set parent section for new object
+ if ( isset( $newObjectNodeID ) && $newObjectNodeID )
+ {
+ $newObjectParentNodeObject = $newObject->attribute( 'main_node' )->attribute( 'parent' )->attribute( 'object' );
+ $newObject->setAttribute( 'section_id', $newObjectParentNodeObject->attribute( 'section_id' ) );
+ $newObject->store();
+ }
+
// edit attributes
$newVersionObject = $newObject->attribute( 'current' );
$newObjectDataMap = $newVersionObject->attribute('data_map');

0 comments on commit ee0b17b

Please sign in to comment.