Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. function buy_art_callback($ajax) {
  2.   if ($ajax) {
  3.     ctools_include('ajax');
  4.     ctools_include('modal');
  5.  
  6.     $form_state = array(
  7.       'ajax' => TRUE,
  8.       'title' => t('Buy now with 1-Click'),
  9.     );
  10.  
  11.     // Use ctools to generate ajax instructions for the browser to create
  12.     // a form in a modal popup.
  13.     $output = ctools_modal_form_wrapper('buy_art_buy_one_click_form', $form_state);
  14.  
  15.     // If the form has been submitted, there may be additional instructions
  16.     // such as dismissing the modal popup.
  17.     if (!empty($form_state['ajax_commands'])) {
  18.       $output = $form_state['ajax_commands'];
  19.     }
  20.  
  21.     // Return the ajax instructions to the browser via ajax_render().
  22.     print ajax_render($output);
  23.     drupal_exit();
  24.   }
  25.   else {
  26.     return drupal_get_form('buy_art_buy_one_click_form');
  27.   }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement