Project

General

Profile

Revision b0dc3a2e

Added by Julien Enselme over 7 years ago

Update to Drupal 7.52

View differences:

drupal7/includes/form.inc
105 105
 *   generate the same form (or very similar forms) using different $form_ids
106 106
 *   can implement hook_forms(), which maps different $form_id values to the
107 107
 *   proper form constructor function. Examples may be found in node_forms(),
108
 *   and search_forms().
108
 *   and search_forms(). hook_forms() can also be used to define forms in
109
 *   classes.
109 110
 * @param ...
110 111
 *   Any additional arguments are passed on to the functions called by
111 112
 *   drupal_get_form(), including the unique form constructor function. For
......
809 810
    }
810 811
    if (isset($form_definition['callback'])) {
811 812
      $callback = $form_definition['callback'];
812
      $form_state['build_info']['base_form_id'] = $callback;
813
      $form_state['build_info']['base_form_id'] = isset($form_definition['base_form_id']) ? $form_definition['base_form_id'] : $callback;
813 814
    }
814 815
    // In case $form_state['wrapper_callback'] is not defined already, we also
815 816
    // allow hook_forms() to define one.
......
830 831
  // the actual form builder function ($callback) expects. This allows for
831 832
  // pre-populating a form with common elements for certain forms, such as
832 833
  // back/next/save buttons in multi-step form wizards. See drupal_build_form().
833
  if (isset($form_state['wrapper_callback']) && function_exists($form_state['wrapper_callback'])) {
834
  if (isset($form_state['wrapper_callback']) && is_callable($form_state['wrapper_callback'])) {
834 835
    $form = call_user_func_array($form_state['wrapper_callback'], $args);
835 836
    // Put the prepopulated $form into $args.
836 837
    $args[0] = $form;
......
2571 2572
 *   for this element. Return nothing to use the default.
2572 2573
 */
2573 2574
function form_type_textarea_value($element, $input = FALSE) {
2574
  if ($input !== FALSE) {
2575
  if ($input !== FALSE && $input !== NULL) {
2575 2576
    // This should be a string, but allow other scalars since they might be
2576 2577
    // valid input in programmatic form submissions.
2577 2578
    return is_scalar($input) ? (string) $input : '';
......
3028 3029
function password_confirm_validate($element, &$element_state) {
3029 3030
  $pass1 = trim($element['pass1']['#value']);
3030 3031
  $pass2 = trim($element['pass2']['#value']);
3031
  if (!empty($pass1) || !empty($pass2)) {
3032
  if (strlen($pass1) > 0 || strlen($pass2) > 0) {
3032 3033
    if (strcmp($pass1, $pass2)) {
3033 3034
      form_error($element, t('The specified passwords do not match.'));
3034 3035
    }
......
3545 3546
            '#return_value' => $key,
3546 3547
            '#default_value' => isset($value[$key]) ? $key : NULL,
3547 3548
            '#attributes' => $element['#attributes'],
3549
            '#ajax' => isset($element['#ajax']) ? $element['#ajax'] : NULL,
3548 3550
          );
3549 3551
        }
3550 3552
        else {

Also available in: Unified diff