Forums / Developer / How to embed an object form creation in a custom module

How to embed an object form creation in a custom module

Author Message

Matthieu Sévère

Friday 08 January 2010 5:16:41 am

Hello,

I have a custom module and a view : mymodule/myview

I want to embed in the template of my view a form to create a new node and I want to use the "native" edit template so that this embed form can create different objects depending on the context.

To sum up an operator would be great like : {node_create_gui content_type="my_content_type"} and this generate the form :-D*

I'm trying to do that but it means I have to create a draft, ... as the native edit action is quite complex.

What do you think ? Is there a simplier way to do that ?

Thank you :-)

--
eZ certified developer: http://ez.no/certification/verify/346216

tom stovall

Friday 08 January 2010 5:31:24 am

I'm currently working on an employment site where the candidates create a "candidate profile" and the employers create "job listings". I created objects with my module by simply posting the appropriate variables to /content/action. Because ezpub makes you create and object then a new version of that object and then edit that new version, I felt it was more trouble than it was worth trying to reinvent that process.

Matthieu Sévère

Friday 08 January 2010 5:38:31 am

I'm beginning to think that I'm going to create the edit form on my own, try to built it in a "generic" way so that it will be compatible with every datatype and use the eZContentFunctions::createAndPublishObject() to create my object ...

--
eZ certified developer: http://ez.no/certification/verify/346216

Jérôme Vieilledent

Friday 08 January 2010 5:40:13 am

Maybe you should use the same process as for creating comments or forum topics, with the NewButton and other ClassIdentifier input...

Jérôme Vieilledent

Friday 08 January 2010 5:43:39 am

"

I'm beginning to think that I'm going to create the edit form on my own, try to built it in a "generic" way so that it will be compatible with every datatype and use the eZContentFunctions::createAndPublishObject() to create my object ...

"

Why not... But have a look into those files :) :

  • kernel/content/edit.php
  • design/admin/templates/content/edit.tpl
  • design/admin/templates/content/edit_attribute.tpl

Matthieu Sévère

Friday 08 January 2010 5:46:16 am

Yes but I don't want to have to post something to content/action because I want this edit form to be after user/register so I made a redirection using a RedirectAfterUserRegister input to a custom module ...

--
eZ certified developer: http://ez.no/certification/verify/346216

tom stovall

Friday 08 January 2010 6:05:30 am

I use javascript on the registration success page to redirect them after registration. Not perfect, but it works.

Matthieu Sévère

Friday 08 January 2010 6:09:09 am

I thought about that but I need the website to be compatible for non-javascript user ...

That's a pity that there is not a url to trigger everything and like I said in my first post an operator would be awesome :D

--
eZ certified developer: http://ez.no/certification/verify/346216

Jérôme Vieilledent

Friday 08 January 2010 7:08:21 am

Sure, maybe you should code it ;-).

By the way, it's a template function not an operator (this is not exactly the same :))

Matthieu Sévère

Friday 08 January 2010 7:17:27 am

"

Sure, maybe you should code it ;-).

By the way, it's a template function not an operator (this is not exactly the same :))

"

I have no time right know so I choose to use the createAndPublishObject() but maybe later I'll begin to implement the template function ( :D right it's not exactly the same).

Thanks for the help :-)

--
eZ certified developer: http://ez.no/certification/verify/346216