Share » Forums » Developer » Create Object and Child Folder at the...

Create Object and Child Folder at the same time

Create Object and Child Folder at the same time

Monday 15 November 2010 6:37:59 am - 4 replies

Author Message

Heath

Monday 15 November 2010 9:41:17 pm

Hello Håkan,

I too have had customer requests for this exact functionality in the past! In the past we simply created the content structure by hand as needed.

But the solution you describe would be a great contribution for the rest of the community as well.

If you do create the solution you describe would you consider sharing it with the community on http://projects.ez.no

Cheers,

Heath

Brookins Consulting | http://brookinsconsulting.com/
Certified | http://auth.ez.no/certification/verify/380350
Solutions | http://projects.ez.no/users/community/brookins_consulting
eZpedia community documentation project | http://ezpedia.org

Nicolas Pastorino

Monday 15 November 2010 11:24:16 pm

Hi Håkan,

Sounds like a nice feature to have, pretty standard for blogging platforms. One extension exists, under the form of a workflow : Subtree Skeleton Publisher, http://projects.ez.no/ezssp , implementing a similar concept. Much of the code there is likely to be directly re-usable. Also, contributing back to this extension could be a smart move, enlarging its functional scope.

Cheers !

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Håkan Bergman

Tuesday 16 November 2010 2:39:20 am

Thank you for your input.

I Copied the function NewButton that is available at kernel/content/action.php into a new file and made en extension of it.

I am using the class blog_list as the root class for blog_post.

So I did it like this:

IF post to blog_list (node class I am are posting to)

Loop through childs

IF name of child is a blog_folder and name is YEAR

Loop trough that node and its childs

IF name of child is a blog_folder and name is MONTH

Set the node to this NodeID

The ELSE to the second IF is:

ELSE create blog_folder named YEAR

FETCH id of that NODE

create blog_folder named MONTH

Fetch ID of that NODE

set $node = eZContentObjectTreeNode::fetch($node);

Then the normal action script will proceed as normal, just that I switched ID to where the post should be created to the MONTH ID instead of the root folder ID.

I've made an extension and named it ezcreateobject and made a view of createSubFolders.

I am no extension expert so I will just post a link to my solution and if someone with more knowledge could make it better and then maybe post a project on it.

Link: http://s61762.gridserver.com/ezextensions/ezcreateobject_new.zip

This is a very hard coded version, this should be done more through INI-files and hidden form attributes, but it will get people like myself started and probably find a quick solution to things at hand.

Thanks again for your input.

Best regards,

Håkan Bergman

Gaetano Giunta

Tuesday 16 November 2010 4:15:54 am

I'd also suggest improving the existing workflow-based extension rather than hardcoding this into content/action stuff...

Principal Consultant International Business
Member of the Community Project Board

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu