Skip to content

Conversation

@gwwar
Copy link
Contributor

@gwwar gwwar commented Sep 2, 2019

Sometimes we may want to disable full site editing flows in the page editor, but still have access to other features like the post list or start page templates. This is done with the following filter:

add_filter( 'a8c_disable_full_site_editing', '__return_true' );

Changes here update the /sites/mysite endpoint to return site.is_fse_active false when the a8c_disable_full_site_editing returns true.

Screen Shot 2019-09-02 at 5 53 39 PM

Testing Instructions

Screen Shot 2019-09-02 at 5 59 31 PM

Add the following filter to the site, can be done easily in the plugin editor:

add_filter( 'a8c_disable_full_site_editing', '__return_true' );
  • site response should be is_fse_active false,
  • FSE flows for the post editor are not available, but other features still are like Starter Page Templates and Recent Blog Posts

Notice no header/footer, just the plain block editor:
Screen Shot 2019-09-02 at 6 08 44 PM

We still have access to Starter Page Templates
Screen Shot 2019-09-02 at 6 08 37 PM

With the filter added we see is_fse_active is false:
Screen Shot 2019-09-02 at 6 09 36 PM

Part of fixing Automattic/wp-calypso#35854

@gwwar gwwar requested a review from a team September 2, 2019 18:51
@jetpackbot
Copy link
Collaborator

jetpackbot commented Sep 2, 2019

Warnings
⚠️ "Testing instructions" are missing for this PR. Please add some
⚠️ "Proposed changelog entry" is missing for this PR. Please include any meaningful changes

This is an automated check which relies on PULL_REQUEST_TEMPLATE. We encourage you to follow that template as it helps Jetpack maintainers do their job. If you think 'Testing instructions' or 'Proposed changelog entry' are not needed for your PR - please explain why you think so. Thanks for cooperation 🤖

Generated by 🚫 dangerJS against 4b4c6bf

@jeherve jeherve added [Status] In Progress [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] WPCOM API labels Sep 2, 2019
@gwwar
Copy link
Contributor Author

gwwar commented Sep 2, 2019

Related on the wpcom side is D32356-code

if ( ! Jetpack::is_plugin_active( 'full-site-editing/full-site-editing-plugin.php' ) ) {
return false;
}
if ( apply_filters( 'a8c_disable_full_site_editing', false ) ) {
Copy link
Member

Choose a reason for hiding this comment

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

I'd be happy with a docblock here to keep our Codex parser happy. It would also help explain what the filter is going to be used for, as I think it may be a bit confusing for non-a12s right now.

Here is an example:

/**
* Filter if a site is an automated-transfer site.
*
* @module json-api
*
* @since 6.4.0
*
* @param bool is_automated_transfer( $this->blog_id )
* @param int $blog_id Blog identifier.
*/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do, thanks!

@gwwar
Copy link
Contributor Author

gwwar commented Sep 3, 2019

Note that /me/sites is_fse_active is still true with add_filter( 'a8c_disable_full_site_editing', '__return_true' ); but I'll try and update that case in D32356-code

@gwwar gwwar added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Sep 3, 2019
@gwwar
Copy link
Contributor Author

gwwar commented Sep 3, 2019

Thanks for the fixes @glendaviesnz, I've verified the testing flow, and updated the summary to help other reviewers.

Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

Works well for me. Merging.

@jeherve jeherve added this to the 7.7 milestone Sep 3, 2019
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Sep 3, 2019
@jeherve jeherve merged commit 308b9c4 into master Sep 3, 2019
@jeherve jeherve deleted the update/fse-is-active branch September 3, 2019 10:43
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Sep 3, 2019
@jeherve
Copy link
Member

jeherve commented Sep 3, 2019

Cherry-picked to branch-7.7 in 9ac6d2d

jeherve added a commit that referenced this pull request Sep 3, 2019
…ite_editing filter (#13392)

* Update is_fse_active to account for a8c_disable_full_site_editing filter

* Fix method check and add dockblock comment

* Fix typo

* Update docblock to allow parser to create Codex page for filter


Co-authored-by: Glen Davies <[email protected]>
Co-authored-by: Jeremy Herve <[email protected]>
@gwwar
Copy link
Contributor Author

gwwar commented Sep 3, 2019

Thanks @jeherve !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] WPCOM API [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants