Projet

Général

Profil

Révision c9e51f47

Ajouté par Julien Enselme il y a environ 7 ans

Udpate to 7.54

Voir les différences:

drupal7/modules/simpletest/tests/form_test.module
37 37
    'access callback' => TRUE,
38 38
    'type' => MENU_CALLBACK,
39 39
  );
40
  $items['form-test/validate-no-token'] = array(
41
    'title' => 'Form validation without a CSRF token',
42
    'page callback' => 'drupal_get_form',
43
    'page arguments' => array('form_test_validate_no_token'),
44
    'access callback' => TRUE,
45
    'type' => MENU_CALLBACK,
46
  );
40 47
  $items['form-test/limit-validation-errors'] = array(
41 48
    'title' => 'Form validation with some error suppression',
42 49
    'page callback' => 'drupal_get_form',
......
454 461
  drupal_set_message('The form_test_validate_required_form_no_title form was submitted successfully.');
455 462
}
456 463

  
464
/**
465
 * Form builder for testing submission of a form without a CSRF token.
466
 */
467
function form_test_validate_no_token($form, &$form_state) {
468
  $form['submit'] = array(
469
    '#type' => 'submit',
470
    '#value' => 'Save',
471
  );
472

  
473
  $form['#token'] = FALSE;
474

  
475
  return $form;
476
}
477

  
478
/**
479
 * Form submission handler for form_test_validate_no_token().
480
 */
481
function form_test_validate_no_token_submit($form, &$form_state) {
482
  drupal_set_message('The form_test_validate_no_token form has been submitted successfully.');
483
}
484

  
457 485
/**
458 486
 * Builds a simple form with a button triggering partial validation.
459 487
 */

Formats disponibles : Unified diff