Skip to content

Commit

Permalink
#40 fixing issue with dropdown enum loosing case
Browse files Browse the repository at this point in the history
  • Loading branch information
markhuot committed Dec 21, 2017
1 parent 37aaa82 commit b984f48
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Fields/SelectOneBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ function getEnum($field) {
}

static function convertStringToGraphQLEnumValue($string) {
$string = preg_replace('/[^a-z0-9]+/i', ' ', $string);
$string = \craft\helpers\StringHelper::toCamelCase($string);
$string = preg_replace('/[^a-z0-9_]+/i', ' ', $string);
$string = preg_replace_callback('/\s+(.)/', function ($match) {
return ucfirst($match[1]);
}, $string);
if ($string === '') {
$string = 'empty';
}
Expand Down

0 comments on commit b984f48

Please sign in to comment.