Skip to content

Commit

Permalink
Writing prompts: adds a filter for whether prompts are enabled (#27778)
Browse files Browse the repository at this point in the history
  • Loading branch information
creativecoder authored Dec 6, 2022
1 parent 3fcaffd commit 78e32f9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
11 changes: 10 additions & 1 deletion projects/plugins/jetpack/_inc/blogging-prompts.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,16 @@ function jetpack_setup_blogging_prompt_response( $post_id ) {
* @return boolean
*/
function jetpack_are_blogging_prompts_enabled() {
return (bool) get_option( 'jetpack_blogging_prompts_enabled', jetpack_has_write_intent() || jetpack_has_posts_page() );
$prompts_enabled = (bool) get_option( 'jetpack_blogging_prompts_enabled', jetpack_has_write_intent() || jetpack_has_posts_page() );

/**
* Filters whether blogging prompts are enabled.
*
* @since $$next-version$$
*
* @param bool $prompts_enabled Whether blogging prompts are enabled.
*/
return apply_filters( 'jetpack_are_blogging_prompts_enabled', $prompts_enabled );
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: enhancement

Writing prompts: add filter for whether prompts are enabled or not
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ function enabled_field_callback() {
* @return void
*/
function init() {
// If editor extensions are not loaded, don't show the settings.
if ( ! \Jetpack_Gutenberg::should_load() ) {
return;
}

// Blogging prompts is an expermental extension: if expermental blocks are not enabled, don't show the settings.
if ( ! Constants::is_true( 'JETPACK_EXPERIMENTAL_BLOCKS' ) && ! Constants::is_true( 'JETPACK_BETA_BLOCKS' ) ) {
return;
}
Expand Down

0 comments on commit 78e32f9

Please sign in to comment.