Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. function test_menu() {
  2. $items['test'] = array(
  3. 'title' => 'Test Modal',
  4. 'page callback' => 'test_page',
  5. 'access callback' => TRUE,
  6. 'type' => MENU_NORMAL_ITEM,
  7. );
  8. $items['test/%ctools_js/test'] = array(
  9. 'title' => 'Test Content Type',
  10. 'page callback' => 'modal_content',
  11. 'page arguments' => array(1),
  12. 'access callback' => TRUE,
  13. 'type' => MENU_CALLBACK,
  14. );
  15.  
  16. return $items;
  17. }
  18.  
  19. function test_page() {
  20. global $user;
  21.  
  22. ctools_include('ajax');
  23. ctools_include('modal');
  24.  
  25. ctools_modal_add_js();
  26.  
  27. $output = ctools_modal_text_button(t('Modal Content'), 'test/nojs/call', 'test');
  28.  
  29. return array('markup' => array('#markup' => $output));
  30. }
  31.  
  32.  
  33. function modal_content($js = FALSE) {
  34.  
  35. ctools_include('node.pages', 'node', '');
  36.  
  37. if (!$js) {
  38. return drupal_get_form('test_node_form');
  39. }
  40.  
  41. ctools_include('modal');
  42. ctools_include('ajax');
  43. $form_state = array(
  44. 'title' => t('Add Notification'),
  45. 'ajax' => TRUE,
  46. );
  47. $output = ctools_modal_form_wrapper('test_node_form', $form_state);
  48. if (!empty($form_state['executed'])) {
  49.  
  50. }
  51. print ajax_render($output);
  52. exit;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement