You are here

private function SettingsPopup::tryHex in General Data Protection Regulation Compliance 8

Try hex.

1 call to SettingsPopup::tryHex()
SettingsPopup::submitForm in src/Form/SettingsPopup.php
Implements a form submit handler.

File

src/Form/SettingsPopup.php, line 185

Class

SettingsPopup
Implements the form controller.

Namespace

Drupal\gdpr_compliance\Form

Code

private function tryHex($color) {
  $result = FALSE;
  $hex = str_replace('#', '', trim($color));
  if (strlen($hex) == 6 && ctype_xdigit($hex)) {
    $result = "#{$hex}";
  }
  return $result;
}