Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
79552ae
commit 1e4e28d
Showing
5 changed files
with
183 additions
and
37 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Extensions/FieldTypeExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Collections.Generic; | ||
using GraphQL.Types; | ||
|
||
namespace OrchardCore.ContentManagement.GraphQL | ||
{ | ||
public static class FieldTypeExtensions | ||
{ | ||
public static FieldType WithPartCollapsedMetaData(this FieldType fieldType, bool collapsed = true) | ||
{ | ||
return fieldType.WithMetaData("PartCollapsed", collapsed); | ||
} | ||
|
||
public static FieldType WithPartNameMetaData(this FieldType fieldType, string partName) | ||
{ | ||
return fieldType.WithMetaData("PartName", partName); | ||
} | ||
|
||
internal static FieldType WithMetaData(this FieldType fieldType, string name, object value) | ||
{ | ||
if (fieldType == null) | ||
{ | ||
return null; | ||
} | ||
|
||
if (fieldType.Metadata == null) | ||
{ | ||
fieldType.Metadata = new Dictionary<string, object>(); | ||
} | ||
|
||
if (!fieldType.HasMetadata(name)) | ||
{ | ||
fieldType.Metadata.Add(name, value); | ||
} | ||
|
||
return fieldType; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters