-
Notifications
You must be signed in to change notification settings - Fork 30
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 group block-variation to provide context like the existing gatherpress/venue block does #629
Open
1 of 5 tasks
Labels
Comments
This was referenced Mar 31, 2024
carstingaxion
changed the title
DRAFT:: BLOCK Add group block-variation to provide context like the existing gatherpress/venue block does
BLOCK Add group block-variation to provide context like the existing gatherpress/venue block does
Mar 31, 2024
carstingaxion
changed the title
BLOCK Add group block-variation to provide context like the existing gatherpress/venue block does
Add group block-variation to provide context like the existing gatherpress/venue block does
May 31, 2024
Bildschirmaufzeichnung.vom.18.07.2024.23.10.33.mp4RelatedNote to self: see Part 4 of Create your First App with Gutenberg Data: Or watch https://github.com/bacoords/block-styles-manager/tree/main/src |
|
This was referenced Jul 18, 2024
carstingaxion
added a commit
to carstingaxion/gatherpress-venue
that referenced
this issue
Jul 21, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your enhancement related to a problem? Please describe.
tl/dr:
Install the demo plugin using the main.zip AND checkout the corresponding experimental branch of the GatherPress plugin to try out my exploration.
You can test the block within the GatherPress Block Playground
With the introduction of block-variations to provide greater flexibility for all kinds of event and venue data, the existing
gatherpress/venue
block needs to be split into separate blocks.GatherPress’ users needs a way to edit the venue details within an event using the same UI concepts, they already know and are familiar with. This means, that all parts of venue information needs to become separate blocks. This for itself seems to be trivial, as all the data already exists and the new Block Bindings API makes it easy to get and show this data. But how to make use of such
gp_venue
-related blocks within angp_event
post type?GatherPress needs a way to provide context to these venue blocks within an event.
Within the editor the
context
property is mainly used to show content of dynamic blocks, such ascore/post-title
orcore/featured-image
. Context contains at least a post ID and a post type.I’d like to suggest the inclusion of a new kind of wrapper block, that provides the needed context to show data from another post type,
gp_venue
s in this case.My proposed block is a variation of the
core/group
block. It provides context into a selected OR inherited venue post. The venue is promoted to allinnerBlocks
using context.The default
innerBlocks
are set to be the new to registervenue-details
block-pattern, which should receive all relevant blocks hooked in automatically.used within Events
Probably the most important use-case, is to show venue details on an event page or in any kind of event (query) list.
The block(-variation) is a dynamic and context-aware block. This means the block shows the venue of the current event. This is the same in the editor, in the frontend, in singular views or used within a query block.
Inside the editor, the block acts as the taxonomy term selector for the given event. A selected venue will be assigned to the currently edited event. Identical to how the existing
gatherpress/venue
block does it.used anywhere else
Used in any other context than an event post, the block works more as a portal block.
The block still allows to select a venue, but instead of acting on the post level, this time the selected venue is saved into the blocks attributes. The block(-variation) is now a dynamic and context-unaware block.
To be able to use this block everywhere, would be new and a change to the current behaviour, which
isshouldcould be discussed in ... #207open ... problems, challenges, questions
global $post
might be a very bad idea and should be avoided.But how?
setup_postdata()
was not enough.This was or is needed because the
core/post-title
block, did not respect the givencontext
- in opposite to all other core blocks ... because ... surprise:Designs
Use within an Event
Bildschirmaufzeichnung.vom.31.03.2024.10.23.16.mp4
Use anywhere else - in a post for example
Bildschirmaufzeichnung.vom.31.03.2024.08.06.08.mp4
Use within a Query block
...
The current code is an experiment, I didn't take any time (yet !) for documentation, coding standards and testing.
And I'm an absolute
react
noob, so my components will probably render way too often. Please take a look at performance.Describe alternatives you've considered
I've spent half the time working on a block-variation of the
core/query
block, because this one seemed to be the best fit, as it already provides context. But ... long story short ... this didn't work.I guess I could write an essay about this journey as well, but I'll keep this, and the code, for later in case the group block variation is not going to be the right direction.
Code of Conduct
The text was updated successfully, but these errors were encountered: