Skip to content
Open
Changes from all commits
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
11 changes: 10 additions & 1 deletion lib/experimental/synchronization.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ function gutenberg_add_collaborative_editing_post_type_support() {
return;
}

foreach ( array( 'page', 'post' ) as $post_type ) {
/*
* Filter the post types that support collaborative editing.
* By default, only 'post' and 'page' support it.
*
* @param array $post_types Array of post type names.
* @return array Filtered array of post type names.
*/
$post_types = apply_filters( 'collaborative_editing_post_types', array( 'page', 'post' ) );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, we have instructions for this in the RTC plugin's README to do the following to bake in this support for other post types:

add_post_type_support( $post_type, 'collaborative-editing' )

That ties into how we have been relying on what the post supports to drive the collaboration related pieces.

Personally, I like that more and would instead push to update whatever docs we can to add the above instruction in. It'd be better to have it Gutenberg rather than in our RTC plugin.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I didn't intent this when suggesting it, it could also be used to remove support for either post or page but I can see the route here.

Perhaps we can remove this completely, but unsure how it would then default to work on a standard install, as you wouldn't want to force code to be written to use a feature.


foreach ( $post_types as $post_type ) {
if ( post_type_exists( $post_type ) ) {
add_post_type_support( $post_type, 'collaborative-editing' );
}
Expand Down
Loading