diff --git a/modules/graphql_compose_views/src/Plugin/GraphQLCompose/SchemaType/View.php b/modules/graphql_compose_views/src/Plugin/GraphQLCompose/SchemaType/View.php index 7c232d371b2a48895d75eaafe0f76734a94ac512..cdf0afab5615a8fe26abf007d5763db52e7bfd06 100644 --- a/modules/graphql_compose_views/src/Plugin/GraphQLCompose/SchemaType/View.php +++ b/modules/graphql_compose_views/src/Plugin/GraphQLCompose/SchemaType/View.php @@ -421,6 +421,9 @@ class View extends GraphQLComposeSchemaTypeBase { $type_fields[$field_alias] = $custom_scalar; } + elseif ($field_type == 'List String') { + $type_fields[$field_alias] = Type::listOf(Type::string()); + } else { $type_fields[$field_alias] = call_user_func([ Type::class, diff --git a/modules/graphql_compose_views/src/Plugin/views/row/GraphQLFieldRow.php b/modules/graphql_compose_views/src/Plugin/views/row/GraphQLFieldRow.php index 3cae9e152bcac3c3a95e87277367245fe7e0d773..2666c3a5d3791d0f402c4d543d86c087e53f13d1 100644 --- a/modules/graphql_compose_views/src/Plugin/views/row/GraphQLFieldRow.php +++ b/modules/graphql_compose_views/src/Plugin/views/row/GraphQLFieldRow.php @@ -126,6 +126,7 @@ class GraphQLFieldRow extends RowPluginBase { '#type' => 'select', '#options' => [ 'String' => $this->t('String'), + 'List String' => $this->t('List (String)'), 'Int' => $this->t('Int'), 'Float' => $this->t('Float'), 'Boolean' => $this->t('Boolean'), @@ -179,7 +180,6 @@ class GraphQLFieldRow extends RowPluginBase { $output = []; foreach ($this->view->field as $id => $field) { - // Omit excluded fields from the rendered output. if (!empty($field->options['exclude'])) { continue; @@ -235,6 +235,10 @@ class GraphQLFieldRow extends RowPluginBase { $value = (float) filter_var($value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); } + if ($this->getFieldType($id) == 'List String') { + $value = array_map('trim', array_filter(explode($field->options['separator'], $value))); + } + $output[$this->getFieldKeyAlias($id)] = $value; }