Skip to content

Commit 556b4dd

Browse files
blazeyofubhy
authored andcommitted
#351 Made views filter input type name configrable. It's now derived from query name. (#382)
1 parent bc63ae7 commit 556b4dd

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

modules/graphql_views/src/Plugin/Deriver/ViewFilterInputDeriver.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function getDerivativeDefinitions($basePluginDefinition) {
2424
continue;
2525
}
2626

27+
/** @var \Drupal\graphql\Plugin\views\display\GraphQL $display */
2728
$display = $this->getViewDisplay($view, $displayId);
2829
$id = implode('_', [$viewId, $displayId, 'view', 'filter', 'input']);
2930

@@ -55,7 +56,7 @@ public function getDerivativeDefinitions($basePluginDefinition) {
5556

5657
$this->derivatives[$id] = [
5758
'id' => $id,
58-
'name' => StringHelper::camelCase($id),
59+
'name' => $display->getGraphQLFilterInputName(),
5960
'fields' => $fields,
6061
'view' => $viewId,
6162
'display' => $displayId,

src/Plugin/views/display/GraphQL.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,16 @@ public function getGraphQLRowName() {
131131
return $this->getGraphQLName('row', TRUE);
132132
}
133133

134+
/**
135+
* Gets the filter input name based on user defined query name or the default one.
136+
*
137+
* @return string
138+
* Result name.
139+
*/
140+
public function getGraphQLFilterInputName() {
141+
return $this->getGraphQLName('filter_input', TRUE);
142+
}
143+
134144
/**
135145
* Returns the id based on user-provided query name or the default one.
136146
*

0 commit comments

Comments
 (0)