-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #888 from carstingaxion/feature/prepare-for-new-bl…
…ocks Prepare for new block variations 1/3: hookable-patterns, slot-fills & docs
- Loading branch information
Showing
13 changed files
with
229 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('moment', 'react-jsx-runtime', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => 'd92b459db2bb69605022'); | ||
<?php return array('dependencies' => array('moment', 'react-jsx-runtime', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '5cfc4e82d4b3e03141f6'); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Blocks in GatherPress | ||
|
||
1. All blocks in general (LINK to /docs/user/...) | ||
2. [Hookable patterns for events & venues](./hookable-patterns/) | ||
- Add to or Remove blocks from the post type block templates | ||
3. [Slots & fills in GatherPress Admin UI](./slot-fills/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Hookable patterns for events & venues | ||
|
||
GatherPress registers multiple invisible block-patterns, that are used as template properties of the main post types. | ||
|
||
Patterns allow to be filtered by the (upgraded since WordPress 6.5) Block Hooks API. Making use of this API brings some advantages, which are at least: | ||
|
||
- GatherPress' blocks can be easily moved, modified or removed by extenders via standardized core code | ||
- GatherPress provides central entry points for plugin developers to hook in own blocks, to extend GatherPress | ||
- GatherPress' blocks will provide their hooking code themself, which keeps concerns separate and code clean | ||
|
||
For example when you create a new event post, it gets pre-poulated with a set of blocks, curated within a block-pattern named `gatherpress/event-template`. | ||
|
||
GatherPress combines four of such block-patterns to curate the creation of: | ||
|
||
- [New Events](#new-event) | ||
- [New Venues](#new-venue) | ||
- [New Event Queries within any post](#new-event-queries-within-any-post) | ||
- [Venue Details within any post](#venue-details-within-any-post) | ||
|
||
## New Event | ||
|
||
GatherPress adds the following blocks by default into a new created event: | ||
|
||
- A block-pattern named `gatherpress/event-template`. | ||
|
||
|
||
## New Venue | ||
|
||
A new created venue will have the following blocks prepared by default: | ||
|
||
- A block-pattern named `gatherpress/venue-template` | ||
- A block-pattern named `gatherpress/venue-details`, which keeps detailed information about a selected venue in the shape of blocks | ||
|
||
## New Event Queries within any post | ||
|
||
## Venue Details within any post | ||
|
||
### Resources | ||
|
||
- [@wordpress/hooks - Block Editor Handbook | Developer.WordPress.org](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-hooks/) | ||
- [#devnote - Introducing Block Hooks for dynamic blocks - Make WordPress Core](https://make.wordpress.org/core/2023/10/15/introducing-block-hooks-for-dynamic-blocks/) | ||
- [Exploring the Block Hooks API in WordPress 6.5 - WordPress Developer Blog](https://developer.wordpress.org/news/2024/03/25/exploring-the-block-hooks-api-in-wordpress-6-5/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Slots & fills in GatherPress Admin UI | ||
|
||
Similar to the central entry points for blocks – GatherPress' [hookable-patterns](./../hookable-patterns/), the plugin provides central administrative entry-points within the post- and site-editor for all block settings. | ||
|
||
GatherPress keeps relevant post data about the currently edited venue or event post within slot inside the `InseptorControls` panel, specific for each post type. These open slots are used by GatherPress itself and can be filled externally. | ||
|
||
Every slot belongs to one of each post type. Additionally the venue-slot will be added to the event-slot automatically. | ||
|
||
Every GatherPress block with own administrative sidebar-elements registers a fill for either the venue- or the events-slot. Plugin developers should provide their additions to GatherPress within the slots as well, which will help keeping the overall admin interface clean & consistent. | ||
|
||
## Available Slots | ||
|
||
- `EventPluginDocumentSettings` A slot that has all settings related to an event. | ||
- `VenuePluginDocumentSettings` A slot that has all settings related to a venue. | ||
|
||
All slots will be rendered into the `PluginDocumentSettingPanel` imported from the `@wordpress/editor` package. This panel is shown in the document sidebar for the event and venue post types [in both the post and site editor][devnote]. | ||
|
||
## Fills by GatherPress | ||
|
||
- `VenuePluginFill` loads the `VenuePluginDocumentSettings` slot into the `EventPluginDocumentSettings` slot, so that venue changes can be made from within an event context. | ||
|
||
|
||
## Add or remove UI elements | ||
|
||
```js | ||
export default function GatherPressAwesomeFill() { | ||
return ( | ||
<> | ||
<Fill name="EventPluginDocumentSettings"> | ||
<p>A note that will be seen in the document sidebar under "Event settings".</p> | ||
</Fill> | ||
</> | ||
); | ||
} | ||
``` | ||
|
||
|
||
### Resources | ||
|
||
- [Unified Extensibility APIs in 6.6][devnote] | ||
|
||
[devnote]: https://make.wordpress.org/core/2024/06/18/editor-unified-extensibility-apis-in-6-6/ "#devnote - Editor: Unified Extensibility APIs in 6.6 – Make WordPress Core" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Defines an extensibility slot for the "Event Settings" panel. | ||
*/ | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createSlotFill, PanelRow } from '@wordpress/components'; | ||
|
||
export const { Fill, Slot } = createSlotFill('EventPluginDocumentSettings'); | ||
export const EventPluginDocumentSettings = ({ children, className }) => ( | ||
<Fill> | ||
<PanelRow className={className}>{children}</PanelRow> | ||
</Fill> | ||
); | ||
|
||
EventPluginDocumentSettings.Slot = Slot; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Fill the "Venue Settings" slot into the "Event Settings" slot by default, | ||
* so that venue changes can be made from within an event context. | ||
*/ | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Fill } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { VenuePluginDocumentSettings } from './slot'; | ||
|
||
export default function VenuePluginFill() { | ||
return ( | ||
<> | ||
<Fill name="EventPluginDocumentSettings"> | ||
<VenuePluginDocumentSettings.Slot /> | ||
</Fill> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Defines as extensibility slot for the "Venue Settings" panel. | ||
*/ | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createSlotFill, PanelRow } from '@wordpress/components'; | ||
|
||
export const { Fill, Slot } = createSlotFill('VenuePluginDocumentSettings'); | ||
export const VenuePluginDocumentSettings = ({ children, className }) => ( | ||
<Fill> | ||
<PanelRow className={className}>{children}</PanelRow> | ||
</Fill> | ||
); | ||
|
||
VenuePluginDocumentSettings.Slot = Slot; |