Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add block collections #17609

Merged
merged 4 commits into from
Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update the docs
  • Loading branch information
scruffian committed Jan 6, 2020
commit 408158b6f159a5b2a7e23fad9b82579538630679
Original file line number Diff line number Diff line change
Expand Up @@ -670,19 +670,21 @@ Blocks can be added to collections, grouping together all blocks from the same o

This should match the namespace declared in the block name; the name of your plugin or theme.

### Title
### Settings

#### Title

* **Type:** `String`

This will display in the block inserter section, which will list all blocks in this collection.

### Icon
#### Icon

* **Type:** `Object`

(Optional) An icon to display alongside the title in the block inserter.

```js
// Registering a block collection
registerBlockCollection( 'my-plugin', 'My Plugin' );
registerBlockCollection( 'my-plugin', { title: 'My Plugin' } );
```
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ _Parameters_

_Returns_

- `Array`: Collections list.
- `Object`: Collections list.

<a name="getDefaultBlockName" href="#getDefaultBlockName">#</a> **getDefaultBlockName**

Expand Down
2 changes: 1 addition & 1 deletion packages/blocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ Registers a new block collection to group blocks in the same namespace in the in
_Parameters_

- _namespace_ `string`: The namespace to group blocks by in the inserter; corresponds to the block namespace
- _title_ `Object`: , icon The title to show in the inserter, The icon to show in the inserter
- _settings_ `Object`: An object composed of a title to show in the inserter, and an icon to show in the inserter

<a name="registerBlockStyle" href="#registerBlockStyle">#</a> **registerBlockStyle**

Expand Down
4 changes: 2 additions & 2 deletions packages/blocks/src/api/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ export function registerBlockType( name, settings ) {
/**
* Registers a new block collection to group blocks in the same namespace in the inserter.
*
* @param {string} namespace The namespace to group blocks by in the inserter; corresponds to the block namespace
* @param {Object} title, icon The title to show in the inserter, The icon to show in the inserter
* @param {string} namespace The namespace to group blocks by in the inserter; corresponds to the block namespace
* @param {Object} settings An object composed of a title to show in the inserter, and an icon to show in the inserter
*
*/
export function registerBlockCollection( namespace, { title, icon } ) {
Expand Down
2 changes: 1 addition & 1 deletion packages/blocks/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export function getCategories( state ) {
*
* @param {Object} state Data state.
*
* @return {Array} Collections list.
* @return {Object} Collections list.
*/
export function getCollections( state ) {
return state.collections;
Expand Down