SHARE
TWEET

Untitled

a guest Sep 14th, 2017 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function chucknorris_permission() {
  4.  return array(
  5.     'access chucknorris module' => array(
  6.       'title' => t('Access Chuck Norris Module'),
  7.       'description' => t('Access to proba list items.'),
  8.     ),
  9.  
  10.   );
  11. }
  12.  
  13. function chucknorris_menu() {
  14.   $items['chucknorris'] = array(
  15.     'title' => 'Warning! Chuck Norris will kick Your Ass!',
  16.     'page callback' => 'drupal_get_form',
  17.     'access arguments' => array('access content'),
  18.     'page arguments' =>  array('chucknorris_urlap'),
  19.   );
  20.  
  21.  
  22.   return $items;
  23. }
  24.  
  25.  
  26. function chucknorris_urlap($form, &$forms_state) {
  27.     $form['norris'] = array(
  28.     '#type' => 'select',
  29.     '#title' => t('How many kicks do you want?'),
  30.     '#default_value' => t('0'),
  31.     '#options' => array(
  32.       '0' => '0',
  33.       '1' => '1',
  34.       '2' => '2',
  35.       '3' => '3',
  36.       '4' => '4'      
  37.       ),
  38.     '#attached' => array(
  39.        'js' => array(
  40.          drupal_get_path('module', 'chucknorris') . '/chucknorris.js',
  41.        ),
  42.        ),
  43.     '#description' => t('Please select the number of chucknorris rounded kicks!'),
  44.     );
  45.  
  46.     $form['chx_1'] = array(
  47.     '#type' => 'checkbox',
  48.     '#title' => t("The first"),
  49.     '#required' => FALSE,
  50.     );  
  51.  
  52.     $form['chx_2'] = array(
  53.     '#type' => 'checkbox',
  54.     '#title' => t("The second"),
  55.     '#required' => FALSE,
  56.     );  
  57.  
  58.     $form['chx_3'] = array(
  59.     '#type' => 'checkbox',
  60.     '#title' => t("The third"),
  61.     '#required' => FALSE,
  62.     );  
  63.    
  64.     $form['chx_4'] = array(
  65.     '#type' => 'checkbox',
  66.     '#title' => t("The fourth"),
  67.     '#required' => FALSE,
  68.     );          
  69.  
  70.     return $form;
  71. }
RAW Paste Data
Top