Skip to content
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

Post type setting field added #104

Merged
merged 7 commits into from May 22, 2023
Merged

Post type setting field added #104

merged 7 commits into from May 22, 2023

Conversation

jayedul
Copy link
Contributor

@jayedul jayedul commented Feb 23, 2023

Description of the Change

As per current implementation, there is no way to resolve the issue other than explicitly adding convert-to-blocks support during custom post type registration. So, a new field added in writing setting page to enable/disable Convert to Blocks for specific post types without editing code.

Closes #57

How to test the Change

  • Register custom post type
  • Edit/create post
  • Toggle the post type in writing setting page under Convert to Blocks section
  • Check if Gutenberg editor gets enabled/disabled for that post type correctly

Changelog Entry

Added - Setting field added to enable/disable specific custom post type

Credits

Props @jayedul

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@jayedul jayedul requested review from a team and dsawardekar as code owners February 23, 2023 11:59
@jayedul jayedul requested review from Sidsector9 and removed request for a team February 23, 2023 11:59
@jayedul jayedul self-assigned this Feb 23, 2023
Copy link
Member

@Sidsector9 Sidsector9 left a comment

Choose a reason for hiding this comment

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

@jayedul I am seeing the following error in the Settings > Writing page, can you have a look at it?

Screenshot 2023-02-28 at 6 01 58 PM

@jeffpaul jeffpaul added this to the 1.2.0 milestone Mar 3, 2023
@jeffpaul jeffpaul requested a review from Sidsector9 March 3, 2023 22:32
Copy link
Member

@Sidsector9 Sidsector9 left a comment

Choose a reason for hiding this comment

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

Screenshot 2023-03-13 at 4 45 10 PM

@jayedul let me know if I'm understanding this correctly. Should we limit the post types shown to only those that support the block editor? I don't think oEmbed responses, template parts, etc should be a part of this for the same reason.

If so, we can check the support using:

if ( ! use_block_editor_for_post_type( $post_type ) ) {
	continue;
}

Let me know what you think.

@jayedul
Copy link
Contributor Author

jayedul commented Mar 13, 2023

@Sidsector9 I added the checking initially. Then removed as it doesn't exclude all the unnecessary types. You can see in the screenshot before and after adding the check.

Screenshot 2023-03-13 at 8 16 53 PM

@jeffpaul jeffpaul requested review from Sidsector9 and removed request for jeffpaul March 20, 2023 14:10
@Sidsector9
Copy link
Member

@jayedul So I checked, and it seems that template parts, oEmbed does have support for the block editor.
However, I think we can still use use_block_editor_for_post_type() to remove the ones which don't have support.

@jayedul
Copy link
Contributor Author

jayedul commented Apr 6, 2023

@Sidsector9 Block editor check has been added. It can be re-reviewed though eslint test is failing here. There is no JS change in this PR, so I guess this issue is better to be fixed in a new ticket.

Copy link
Member

@Sidsector9 Sidsector9 left a comment

Choose a reason for hiding this comment

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

@jayedul I am seeing fatal error when I save settings after unchecking all the checkboxes.

Screenshot 2023-04-11 at 5 21 26 PM

@jayedul
Copy link
Contributor Author

jayedul commented May 3, 2023

in_array check issue is fixed now. Re-review requested though eslint check is failing. Eslint issue is coming from another package @10up/eslint-config.
Screenshot 2023-05-03 at 2 29 14 PM

@jayedul jayedul requested a review from Sidsector9 May 3, 2023 08:33
@jeffpaul
Copy link
Member

jeffpaul commented May 8, 2023

@Sidsector9 back to you for review

@jeffpaul jeffpaul merged commit 52805fc into develop May 22, 2023
4 of 5 checks passed
@jeffpaul jeffpaul deleted the fix/57 branch May 22, 2023 14:12
@jeffpaul jeffpaul mentioned this pull request Jun 8, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants