Closed bobbingwide closed 4 years ago
I don't know what to do with block.json
.
I don't know what to do with
block.json
.
In WP Block Builder, which delivers two starter blocks, there's a block.json
in each of the blocks source files directory - under src/blocks/block-name
.
So that's probably how to do it. Though I still don't know how code is expected to use this file. None of the existing routines seem to reference it. Does Gutenberg do this automagically?
Having read https://wptavern.com/revised-block-directory-guidelines-proposal-updates-wording-but-changes-little-else I'm tempted to extend the parent block to make it implement a full breadcrumb. It's not rocket science and it should pass guideline 7. Server-side code should be kept to a minimum.
There are limits to the REST API, and situations where server-side PHP is the only performant way to implement a feature. In those situations, PHP code may be included, provided it is clearly written, used as little as possible, and well documented.
But it would need to be a separate plugin, probably called breadcrumbs.
See #4 - the parent block should be moved to a separate Single Block plugin called sb-parent-block.
oik/parent-block has now been moved to https://github.com/bobbingwide/sb-parent-block
Where the children-block shows the children of the current page the parent block will create a link to the parent of the current page. It's a one level breadcrumb.
Block name: oik/parent-block Source: src/parent-block
Creation method:
index.asset.php
.