valueCallableIsSafe example

        if (!$input_exists && !$form_state->isRebuilding() && !$form_state->isProgrammed()) {
          // Add the necessary parent keys to FormState::$input and sets the           // element's input value to NULL.           NestedArray::setValue($form_state->getUserInput()$element['#parents'], NULL);
          $input_exists = TRUE;
        }
        // If we have input for the current element, assign it to the #value         // property, optionally filtered through $value_callback.         if ($input_exists) {
          // Skip all value callbacks except safe ones like text if the CSRF           // token was invalid.           if (!$form_state->hasInvalidToken() || $this->valueCallableIsSafe($value_callable)) {
            $element['#value'] = call_user_func_array($value_callable[&$element$input, &$form_state]);
          }
          else {
            $input = NULL;
          }

          if (!isset($element['#value']) && isset($input)) {
            $element['#value'] = $input;
          }
        }
        // Mark all posted values for validation.
Home | Imprint | This part of the site doesn't use cookies.