code: private static function buildAttribBoolVal($key, $value = true)
      {
          if ($key == 'autocomplete') {
              $value = $value ? 'on' : 'off';
          } elseif ($key == 'spellcheck') {
              $value = $value ? 'true' : 'false';
          } elseif ($key == 'translate') {
              $value = $value ? 'yes' : 'no';
          } elseif ($value) {
              // even if not a recognized boolean attribute
              $value = $key;
          } else {
              $value = null;
          }
          return $value;
      }
docs: Convert boolean attribute value to string
  
  @param string  $key   attribute name
  @param boolean $value true|false
  
  @return string