class ValueCallbackTestHelper

Same name and namespace in other branches
  1. main core/tests/Drupal/KernelTests/Core/Form/ValueCallbackTestHelper.php \Drupal\KernelTests\Core\Form\ValueCallbackTestHelper

A non-static #value_callback target, resolved via the class resolver.

Hierarchy

Expanded class hierarchy of ValueCallbackTestHelper

See also

\Drupal\KernelTests\Core\Form\FormDefaultHandlersTest

File

core/tests/Drupal/KernelTests/Core/Form/ValueCallbackTestHelper.php, line 14

Namespace

Drupal\KernelTests\Core\Form
View source
class ValueCallbackTestHelper {
  
  /**
   * Converts the submitted value to upper case.
   *
   * @param array $element
   *   The form element.
   * @param mixed $input
   *   The submitted input, or FALSE if there is none.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current form state.
   *
   * @return string|null
   *   The input converted to upper case, or NULL.
   */
  public function upperCaseValue(array &$element, mixed $input, FormStateInterface $form_state) : ?string {
    return is_string($input) ? strtoupper($input) : NULL;
  }

}

Members

Title Sort descending Modifiers Object type Summary
ValueCallbackTestHelper::upperCaseValue public function Converts the submitted value to upper case.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.