$sanitizer->option() method

Return $value if it exists in $allowedValues, or null if it doesn't


// basic usage
$string = $sanitizer->option($value);

// usage with all arguments
$string = $sanitizer->option($value, array $allowedValues = []);


valuestring, int
allowedValues (optional)array

Whitelist of option values that are allowed

Return value

string int null

$sanitizer methods and properties

API reference based on ProcessWire core version 3.0.214

Twitter updates

    Error retrieving Twitter status

Latest news

  • ProcessWire Weekly #473
    In the 473rd issue of ProcessWire Weekly we'll check out latest core updates, introduce new third party module called Template Fragment Controller, and more. Read on!
    Weekly.pw / 3 June 2023
  • A look at the new Page Edit Restore module
    The new Page Edit Restore module helps to prevent page edits in the admin from getting lost when the user’s session is lost. This post covers it in detail.
    Blog / 12 May 2023
  • Subscribe to weekly ProcessWire news

“ProcessWire is like a breath of fresh air. So powerful yet simple to build with and customise, and web editors love it too.” —Margaret Chatwin, Web developer