wintercms / wintercms/wn-blocks-plugin
Clarify how blocks are allowed/ignored.
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 29
- Forks
- 7
- Avg merge
- 55m
- Merged PRs (30d)
- 1
Description
I've done several tests on how blocks are allowed, but I'm not sure I understand the hierarchy of allowed blocks/tags.
Starting situation :
- the Winter.Blocks plugin
- a custom plugin defining a block
blog_featured_image.block:
name: ...
description: ...
icon: icon-picture-o
tags: ["blog"]
fields:
...
According to the documentation :
allow: An array of block types that are allowed to be added to the widget. If specified, only those block types listed will be available to add to the current instance of the field. You can define either a straight array of individual blocks to allow, or define an object with tags and/or blocks to allow whole tags or individual blocks.
Example 1:
type: blocks
allow:
- richtext
- columns_two
- title
- blog_featured_image
ignore:
This give me 4 available blocks.
Example 2:
type: blocks
allow:
blocks:
- richtext
- columns_two
- title
- blog_featured_image
tags:
- blog
ignore:
This give me only ONE block (blog_featured_image) because it's the only one that is both in allowed blocks and has its tag in the allowed ones.
Example 3:
type: blocks
allow:
blocks:
- richtext
- columns_two
- title
tags:
- blog
ignore:
It gives me NONE of the blocks because none of them has the tag blog in his definition!
Question:
or define an object with tags and/or blocks to allow whole tags or individual blocks.
I thought that in examples 2 and 3, my list of allowed blocks would include those defined in the allow/blocks and those whose tags are present in the allow/tags.
But from my own test I deduce that it's either one or the other, but not both.
@LukeTowers can you confirm that this is the expected behavior?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the blocks documentation for the allow and ignore options, then compare the stated behavior with the three YAML examples in this issue. Determine whether block names and tags are combined or treated as alternatives, and update the documentation so the resulting available blocks and expected behavior are unambiguous.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100