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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 30 2025 00:45:19
Script start
Timing: Jan 30 2025 00:45:19
Module start 'layout'
Timing: Jan 30 2025 00:45:19
Module start 'content'
Timing: Jan 30 2025 00:45:19
Module end 'content'
Timing: Jan 30 2025 00:45:19
Script end

Main resources:

Total runtime0.0134 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0040 588.3750151.2422
Module start 'layout' 0.00400.0021 739.617236.7109
Module start 'content' 0.00610.0055 776.3281102.9219
Module end 'content' 0.01160.0018 879.250045.9922
Script end 0.0134  925.2422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002518.6453140.0002
Check MTime0.00128.8139140.0001
Mysql Total
Database connection0.00064.288810.0006
Mysqli_queries0.001712.825730.0006
Looping result0.00000.074610.0000
Template Total0.00139.410.0013
Template load0.00107.650610.0010
Template processing0.00021.704910.0002
Override
Cache load0.00075.258510.0007
General
dbfile0.00107.286680.0001
String conversion0.00000.053340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs