original_string: protected function validateColorFieldValue()
      {
          $field = 'color';
  
          if ($this->isExcluded($field)) {
              return null;
          }
  
          $value = $this->getSubmitted($field);
  
          if (!isset($value) || $value === '') {
              return null;
          }
  
          if (preg_match('/#([a-fA-F0-9]{3}){1,2}\b/', $value) !== 1) {
              $this->setErrorInvalid($field, $this->translation->text('Color'));
              return false;
          }
  
          // HTML5 color field cannot have empty value
          // Default value is #000000
          // Assuming black is empty
          if ($value === '#000000') {
              $this->setSubmitted($field, '');
          }
  
          return true;
      }
code: protected function validateColorFieldValue()
      {
          $field = 'color';
  
          if ($this->isExcluded($field)) {
              return null;
          }
  
          $value = $this->getSubmitted($field);
  
          if (!isset($value) || $value === '') {
              return null;
          }
  
          if (preg_match('/#([a-fA-F0-9]{3}){1,2}\b/', $value) !== 1) {
              $this->setErrorInvalid($field, $this->translation->text('Color'));
              return false;
          }
  
          // HTML5 color field cannot have empty value
          // Default value is #000000
          // Assuming black is empty
          if ($value === '#000000') {
              $this->setSubmitted($field, '');
          }
  
          return true;
      }
code_tokens: protected function validateColorFieldValue ( ) { $ field = 'color' ; if ( $ this -> isExcluded ( $ field ) ) { return null ; } $ value = $ this -> getSubmitted ( $ field ) ; if ( ! isset ( $ value ) || $ value === '' ) { return null ; } if ( preg_match ( '/#([a-fA-F0-9]{3}){1,2}\b/' , $ value ) !== 1 ) { $ this -> setErrorInvalid ( $ field , $ this -> translation -> text ( 'Color' ) ) ; return false ; } // HTML5 color field cannot have empty value // Default value is #000000 // Assuming black is empty if ( $ value === '#000000' ) { $ this -> setSubmitted ( $ field , '' ) ; } return true ; }
docstring: Validates a color code
  @return boolean|null
docstring_tokens: Validates a color code