Disable post format input if the theme does not support post formats.#5203
Conversation
| export default PostFormatCheck; | ||
| export default withContext( 'editor' )( | ||
| ( settings ) => ( { | ||
| themeSupportsPostFormats: settings.themeSupportsPostFormats, |
There was a problem hiding this comment.
Maybe destructure settings on L17?
There was a problem hiding this comment.
Thank you for your feedback @ockham, the improvement was applied.
There was a problem hiding this comment.
Alternatively:
( settings ) => pick( settings, 'themeSupportsPostFormats' ),https://lodash.com/docs/4.17.5#pick
Personally, I'm on the fence about whether destructuring arguments in-place harms readability, as it obscures what it is that is being destructured (i.e. we've lost all mention of "settings").
27ffe0f to
266ed31
Compare
lib/client-assets.php
Outdated
| 'availableTemplates' => wp_get_theme()->get_page_templates( get_post( $post_to_edit['id'] ) ), | ||
| 'blockTypes' => $allowed_block_types, | ||
| 'disableCustomColors' => get_theme_support( 'disable-custom-colors' ), | ||
| 'themeSupportsPostFormats' => current_theme_supports( 'post-formats' ), |
There was a problem hiding this comment.
not sure the editor should be aware of the concept of "themes", should just rename the property something like disablePostFormats to match disabledCustomColors's convention
There was a problem hiding this comment.
Code was updated 👍
This is the same behaviour we have currently on the classic. Showing the post format input also has another non-desirable side effect, when the theme does not support post formats, posts are created with standard post format and not the default post format setting. As the setting is not respected, leaving the input there confuses the user.
266ed31 to
ee29111
Compare
|
Docs need to be updated :) |
|
Hi @gziolo, I'm not certain where we should document these behaviours as the flag we use from the theme |
|
Right, skip it then. Probably nothing to worry about for theme developers :) |
This is the same behaviour we have currently on the classic. Showing the post format input also has another non-desirable side effect, when the theme does not support post formats, posts are created with standard post format and not the default post format setting. As the setting is not respected, leaving the input there confuses the user.
How Has This Been Tested?
Verify that in themes that support post formats e.g:Twenty Seventeen, we have the post format input with the value equal to the default post format setting.
Verify that in themes that do not support post formats e.g: Gutenberg theme the post format input does not appear.