You are here

public function HttpConfigRequestForm::booleanValue in HTTP Client Manager 8.2

Value callback: casts provided input to boolean.

Parameters

array $element: The form element.

string $input: The input value.

\Drupal\Core\Form\FormStateInterface $form_state: The Form State instance.

Return value

bool|null The boolean value or NULL if no value has been provided.

File

src/Form/HttpConfigRequestForm.php, line 247

Class

HttpConfigRequestForm
Class HttpConfigRequestForm.

Namespace

Drupal\http_client_manager\Form

Code

public function booleanValue(&$element, $input, FormStateInterface $form_state) {
  if ($input !== FALSE || $input === NULL) {
    return (bool) $input;
  }
  return $element['#default_value'];
}