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

eZ debug

Timing: Jan 29 2025 13:46:36
Script start
Timing: Jan 29 2025 13:46:36
Module start 'content'
Timing: Jan 29 2025 13:46:36
Module end 'content'
Timing: Jan 29 2025 13:46:36
Script end

Main resources:

Total runtime0.1995 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 588.1719180.8125
Module start 'content' 0.00550.0046 768.9844106.6797
Module end 'content' 0.01010.1893 875.6641534.4219
Script end 0.1995  1,410.0859 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00321.5958200.0002
Check MTime0.00140.6895200.0001
Mysql Total
Database connection0.00080.385410.0008
Mysqli_queries0.159579.92341410.0011
Looping result0.00110.55101390.0000
Template Total0.189194.810.1891
Template load0.00070.371910.0007
Template processing0.188394.386310.1883
Override
Cache load0.00050.267210.0005
Sytem overhead
Fetch class attribute can translate value0.00100.487210.0010
XML
Image XML parsing0.00020.116910.0002
General
dbfile0.00381.8838200.0002
String conversion0.00000.001930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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