本文档介绍了 WordPress 核心区块目录的命名空间、选择器和动作,用于管理可下载和已安装的区块插件。它提供了状态查询和操作功能,支持开发者处理区块的安装、卸载和错误通知。
Namespace: core/block-directory.
Returns the available uninstalled blocks.
Parameters
Object: Global application state.string: Search string.Returns
Array: Downloadable blocks.Returns the error notice for a given block.
Parameters
Object: Global application state.string: The ID of the block plugin. eg: my-blockReturns
string|boolean: The error text, or false if no error.Returns all block error notices.
Parameters
Object: Global application state.Returns
Object: Object with error notices.Returns the block types that have been installed on the server in this session.
Parameters
Object: Global application state.Returns
Array: Block type itemsReturns block types that have been installed on the server and used in the current post.
Parameters
Object: Global application state.Returns
Array: Block type items.Returns the block types that have been installed on the server but are not used in the current post.
Parameters
Object: Global application state.Returns
Array: Block type items.Returns true if a block plugin install is in progress.
Parameters
Object: Global application state.string: Id of the block.Returns
boolean: Whether this block is currently being installed.Returns true if application is requesting for downloadable blocks.
Parameters
Object: Global application state.string: Search string.Returns
boolean: Whether a request is in progress for the blocks list.Returns an action object used to add a block type to the “newly installed” tracking list.
Parameters
Object: The block item with the block id and name.Returns
Object: Action object.Sets the error notice to empty for specific block.
Parameters
string: The ID of the block plugin. eg: my-blockReturns
Object: Action object.Returns an action object used in signalling that the downloadable blocks have been requested and are loading.
Parameters
string: Search string.Returns
Object: Action object.Action triggered to install a block plugin.
Parameters
Object: The block item returned by search.Returns
boolean: Whether the block was successfully installed & loaded.Returns an action object used in signalling that the downloadable blocks have been updated.
Parameters
Array: Downloadable blocks.string: Search string.Returns
Object: Action object.Returns an action object used to remove a block type from the “newly installed” tracking list.
Parameters
string: The block item with the block id and name.Returns
Object: Action object.Sets an error notice to be displayed to the user for a given block.
Parameters
string: The ID of the block plugin. eg: my-blockstring: The message shown in the notice.boolean: Whether the user can recover from the error.Returns
Object: Action object.Returns an action object used to indicate install in progress.
Parameters
string:boolean:Returns
Object: Action object.Action triggered to uninstall a block plugin.
Parameters
Object: The blockType object.