yireo/magento2-graph-ql-schema-manipulation
最新稳定版本:0.0.2
Composer 安装命令:
composer require yireo/magento2-graph-ql-schema-manipulation
包简介
Magento module to manipulate the GraphQl schema
README 文档
README
Magento 2 module to manipulate the GraphQL schema before it is being used. This can be useful when trying to remove endpoints that are added by monolithic extensions and perhaps other use-cases.
Installation
composer require yireo/magento2-graph-ql-schema-manipulation bin/magento module:enable Yireo_GraphQlSchemaManipulation
Usage
To manipulate the schema yourself, you will need to create a class similar to the following:
class ExampleSchemaManipulator implements \Yireo\GraphQlSchemaManipulation\Schema\ManipulationInterface { public function manipulateFieldsConfig(array $config): array { foreach ($config as $fieldIndex => $field) { if (in_array($fieldIndex, ['isEmailAvailable'])) { unset($config[$fieldIndex]); } } return $config; } }
Next, create a di.xml file that adds this class to this module:
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Yireo\GraphQlSchemaManipulation\Plugin\AddSchemaManipulators"> <arguments> <argument name="schemaManipulators" xsi:type="array"> <item name="example" xsi:type="object">ExampleSchemaManipulator</item> </argument> </arguments> </type> </config>
统计信息
- 总下载量: 357
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: OSL-3.0
- 更新时间: 2024-08-06