adds addBlockType function to graphql
This commit is contained in:
@@ -32,6 +32,9 @@ function init() {
|
||||
LocaleFloatType: getLocaleFloatType(this.config.localization),
|
||||
blockTypes: {},
|
||||
},
|
||||
addBlockType: (blockType, slug) => {
|
||||
this.graphQL.types.blockTypes[slug] = blockType;
|
||||
},
|
||||
};
|
||||
|
||||
const buildObjectType = getBuildObjectType(this.config, this.graphQL);
|
||||
|
||||
@@ -176,7 +176,7 @@ function getBuildObjectType(config, graphQL) {
|
||||
if (graphQL.types.blockTypes[block.slug] === undefined) {
|
||||
const formattedBlockName = formatName(block.labels.singular);
|
||||
|
||||
graphQL.types.blockTypes[block.slug] = buildObjectType(
|
||||
graphQL.addBlockType(buildObjectType(
|
||||
formattedBlockName,
|
||||
[
|
||||
...block.fields,
|
||||
@@ -191,7 +191,7 @@ function getBuildObjectType(config, graphQL) {
|
||||
},
|
||||
],
|
||||
formattedBlockName,
|
||||
);
|
||||
), block.slug);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user