Révision 6ff32cea
Ajouté par Florent Torregrosa il y a environ 9 ans
drupal7/includes/form.inc | ||
---|---|---|
938 | 938 |
// after the batch is processed. |
939 | 939 |
} |
940 | 940 |
|
941 |
// Set a flag to indicate the the form has been processed and executed.
|
|
941 |
// Set a flag to indicate that the form has been processed and executed.
|
|
942 | 942 |
$form_state['executed'] = TRUE; |
943 | 943 |
|
944 | 944 |
// Redirect the form based on values in $form_state. |
... | ... | |
2451 | 2451 |
$element += array('#default_value' => array()); |
2452 | 2452 |
return $element['#default_value'] + array('pass1' => '', 'pass2' => ''); |
2453 | 2453 |
} |
2454 |
$value = array('pass1' => '', 'pass2' => ''); |
|
2455 |
// Throw out all invalid array keys; we only allow pass1 and pass2. |
|
2456 |
foreach ($value as $allowed_key => $default) { |
|
2457 |
// These should be strings, but allow other scalars since they might be |
|
2458 |
// valid input in programmatic form submissions. Any nested array values |
|
2459 |
// are ignored. |
|
2460 |
if (isset($input[$allowed_key]) && is_scalar($input[$allowed_key])) { |
|
2461 |
$value[$allowed_key] = (string) $input[$allowed_key]; |
|
2462 |
} |
|
2463 |
} |
|
2464 |
return $value; |
|
2454 | 2465 |
} |
2455 | 2466 |
|
2456 | 2467 |
/** |
... | ... | |
2494 | 2505 |
} |
2495 | 2506 |
} |
2496 | 2507 |
|
2508 |
/** |
|
2509 |
* Determines the value for a textarea form element. |
|
2510 |
* |
|
2511 |
* @param array $element |
|
2512 |
* The form element whose value is being populated. |
|
2513 |
* @param mixed $input |
|
2514 |
* The incoming input to populate the form element. If this is FALSE, |
|
2515 |
* the element's default value should be returned. |
|
2516 |
* |
|
2517 |
* @return string |
|
2518 |
* The data that will appear in the $element_state['values'] collection |
|
2519 |
* for this element. Return nothing to use the default. |
|
2520 |
*/ |
|
2521 |
function form_type_textarea_value($element, $input = FALSE) { |
|
2522 |
if ($input !== FALSE) { |
|
2523 |
// This should be a string, but allow other scalars since they might be |
|
2524 |
// valid input in programmatic form submissions. |
|
2525 |
return is_scalar($input) ? (string) $input : ''; |
|
2526 |
} |
|
2527 |
} |
|
2528 |
|
|
2497 | 2529 |
/** |
2498 | 2530 |
* Determines the value for a textfield form element. |
2499 | 2531 |
* |
... | ... | |
2509 | 2541 |
*/ |
2510 | 2542 |
function form_type_textfield_value($element, $input = FALSE) { |
2511 | 2543 |
if ($input !== FALSE && $input !== NULL) { |
2512 |
// Equate $input to the form value to ensure it's marked for |
|
2513 |
// validation. |
|
2514 |
return str_replace(array("\r", "\n"), '', $input); |
|
2544 |
// This should be a string, but allow other scalars since they might be |
|
2545 |
// valid input in programmatic form submissions. |
|
2546 |
if (!is_scalar($input)) { |
|
2547 |
$input = ''; |
|
2548 |
} |
|
2549 |
return str_replace(array("\r", "\n"), '', (string) $input); |
|
2515 | 2550 |
} |
2516 | 2551 |
} |
2517 | 2552 |
|
Formats disponibles : Unified diff
Update core to 7.36