Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By firdous.ali86 on
Hi,
ive been using ctools to display forms in popup modal dialogs,
can i use ctools for displaying nodes and 'Views' too? or is it only for forms?
Comments
is there a function like
is there a function like ctools_modal_page_wrapper()? well obviously there isnt, but any function that does render the page to display in a modal
Ctools includes some
Ctools includes some examples, I thought there was a non-form example.
while going through modal.inc
while going through modal.inc i learnt how to do it, i simply had to use ctools_modal_render($title, $output) to print my modal dialog, its great tool :)
FIrdous
Can you further explain
Can you further explain this ctools_modal_render($title, $output) a bit more please? i want to have a popup modal having comments form in it. i am using drupal 7.
Ahmad Nawaz
Acquia Certified Developer
Email: hmdnawaz@gmail.com
Skype: hmdnawaz
Hi, This question was for
Hi,
This question was for popup modals in which there is no form, for forms example you can see the ctools ajax example module that comes with the ctools module.
Thanks,
Firdous
Subscribe
Subscribe
See this Discussion of Comment Forms and Nodes in Modals
See this ongoing issue: http://drupal.org/node/828794#comment-5518224
firdous_kind86 would you
firdous_kind86 would you please share the entire code plus the link you used to activate the modal? I am not an experienced programmer and would really appreciate seeing this all put together in one place correctly. The CTools documentation is confusing to me. I've spent days on this since November 2011 and asked for help from lots of people. No one seems to know yet exactly how to solve the problem, but you sound like you had success. I just want to bring up a node in a modal. Thanks.
Here are some codes to render
Here are some codes to render a node inside a ctools modal :
Thanks
Thanks, Arshad. I tried the code you listed, and I'm still having to add the following to activate a modal:
ctools_include('modal');
ctools_modal_add_js();
Also, I'm not sure how to format a link to the node. This does not work:
<a class="ctools-use-modal" href="/js/node/[nid]">Modal Test</a>
Please forgive me for being so simple, here. I'm not a programmer, but I would really like to make a modal work. Thanks.
You can use this to create a
You can use this to create a link
Thanks, I still need to work on this
Thanks, Arshad. I think I need to learn more about php, because I'm getting an error, a call to an undefined function. Trying to create a modal is hard for a non-programmer like me, but I have a book on Ajax and PHP that I need to read. Maybe that will help me. Thanks for your code. I plan to keep trying.
i'm looking for a long time
i'm looking for a long time to create modal form via ctools...
but it always return this error:
[{"command":"settings","settings":{"basePath":"\/drupal-7.19\/","pathPrefix":"","ajaxPageState":{"theme":"bartik","theme_token":"L8sJ_9AZ1jEHhPEfo85PkDBreUd9_uWXDqhyv6Ru_so"},"overlay":{"paths":{"admin":"node\/*\/edit\nnode\/*\/delete\nnode\/*\/revisions\nnode\/*\/revisions\/*\/revert\nnode\/*\/revisions\/*\/delete\nnode\/add\nnode\/add\/*\noverlay\/dismiss-message\nuser\/*\/shortcuts\nadmin\nadmin\/*\nbatch\ntaxonomy\/term\/*\/edit\nuser\/*\/cancel\nuser\/*\/edit\nuser\/*\/edit\/*","non_admin":"admin\/structure\/block\/demo\/*\nadmin\/reports\/status\/php"},"pathPrefixes":[],"ajaxCallback":"overlay-ajax"}},"merge":true},{"command":"modal_display","title":"About Us","output":"\u003Cdiv id=\u0022node-1\u0022 class=\u0022node node-page node-promoted node-sticky contextual-links-region clearfix\u0022 about=\u0022\/drupal-7.19\/node\/1\u0022 typeof=\u0022foaf:Document\u0022\u003E\n\n \u003Ch2 property=\u0022dc:title\u0022 datatype=\u0022\u0022\u003E\n \u003Ca href=\u0022\/drupal-7.19\/node\/1\u0022\u003EAbout Us\u003C\/a\u003E\n \u003C\/h2\u003E\n \u003Cdiv class=\u0022contextual-links-wrapper\u0022\u003E\u003Cul class=\u0022contextual-links\u0022\u003E\u003Cli class=\u0022node-edit first\u0022\u003E\u003Ca href=\u0022\/drupal-7.19\/node\/1\/edit?destination=happy\/ajax\/1\u0022\u003EEdit\u003C\/a\u003E\u003C\/li\u003E\n\u003Cli class=\u0022node-delete last\u0022\u003E\u003Ca href=\u0022\/drupal-7.19\/node\/1\/delete?destination=happy\/ajax\/1\u0022\u003EDelete\u003C\/a\u003E\u003C\/li\u003E\n\u003C\/ul\u003E\u003C\/div\u003E\n \n \u003Cdiv class=\u0022content clearfix\u0022\u003E\n \u003Cdiv class=\u0022field field-name-body field-type-text-with-summary field-label-hidden\u0022\u003E\u003Cdiv class=\u0022field-items\u0022\u003E\u003Cdiv class=\u0022field-item even\u0022 property=\u0022content:encoded\u0022\u003Eafasdfasdf\u003C\/div\u003E\u003C\/div\u003E\u003C\/div\u003E \u003C\/div\u003E\n\n \n \n\u003C\/div\u003E\n"}]
i'm copy almost of your code
the link to access is: localhost/happy/ajax/1
nojs, js or any text argurment means $js=0. only 'ajax' argument means $js=1
PLEASE HELP!
my environtment: fresh drupal
my environtment:
fresh drupal 7.19 (no more contrib module)
lastest views
lastest ctools
ubuntu 12.04
debug both of chrome or firefox
i tried to fix this error in 2 weeks and no result. too much tired
Find an easier alternative
@quano1 If you are having a hard time, I suggest you do something different than using a modal. Modals require a lot of knowledge, and there is currently no easy module to help implement specialty situations.
thank you, but modal form is
thank you, but modal form is so much powerful at now, isn't it?
I think I have no choice
solved
yeah. the only way i know just now is use this fuction:
print ctools_modal_text_button(t('title'),'/happy/nojs/1',t('alt'));
2 weeks for this solution..
I am getting an ajax error:
I am getting an ajax error:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: http://localhost/restylr/node/ajax/10
StatusText: error
ResponseText: Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2168 of /opt/lampp/htdocs/restylr/includes/database/database.inc).
Does anyone knows a solution for this?
render a VIEW & Form in Ctools popup
To render a FORM in Ctools popup use function :
ctools_modal_form_wrapper('myform',$form_state);
To render a VIEW in Ctools popup :
//write this code in your ajax callback function its help you
$output = views_embed_view('yourview','page');
return ctools_modal_render($output);