Guest User

Untitled

a guest
Apr 29th, 2013
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.00 KB | None | 0 0
  1. <?php
  2.  
  3. function mvp_form_test_block_info() {
  4.   $blocks = array(
  5.     'mvp_form_test_test_block' => array(
  6.       'info' => 'Test Form',
  7.       'cache' => DRUPAL_CACHE_GLOBAL,
  8.       'properties' => array(
  9.         'administrative' => true,
  10.       ),
  11.     ),
  12.   );
  13.   return $blocks;
  14. }
  15.  
  16. function mvp_form_test_block_view($delta='') {
  17.   if ($delta != 'mvp_form_test_test_block')
  18.     return array();
  19.  
  20.   return array(
  21.     'title' => 'Test Block',
  22.     'content' => drupal_get_form('mvp_form_test_test_form'),
  23.   );
  24. }
  25.  
  26. function mvp_form_test_test_form($form, &$form_state) {
  27.   $form = array();
  28.   $form['sometext'] = array(
  29.     '#type' => 'textfield',
  30.   );
  31.   $form['button'] = array(
  32.     '#type' => 'submit',
  33.     '#value' => 'Submit',
  34.   );
  35.   return $form;
  36. }
  37.  
  38. function mvp_form_test_test_form_submit($form, $form_state) {
  39.   watchdog('mvp_form_test', 'Form submitted with text '.$form_state['values']['sometext']);
  40.   drupal_set_message('Form submitted with text '.$form_state['values']['sometext']);
  41. }
  42.  
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment