Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
50.00% covered (danger)
50.00%
1 / 2
100.00% covered (success)
100.00%
1 / 1
CRAP
n/a
0 / 0
wpcom_agents_manager_enable_in_block_editor
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2/**
3 * Loads the Agents Manager in the block editor on WordPress.com sites with the WordPress Agent enabled.
4 *
5 * @package automattic/jetpack-mu-wpcom
6 */
7
8/**
9 * Enable the Agents Manager in the block editor when the WordPress Agent is on.
10 *
11 * Preserves an existing true so other integrations (such as the Jetpack AI
12 * Sidebar) can request the shell independently.
13 *
14 * @param mixed $enabled Whether an earlier filter already enabled it.
15 * @return bool
16 */
17function wpcom_agents_manager_enable_in_block_editor( $enabled ): bool {
18    return (bool) $enabled || wpcom_is_wordpress_agent_enabled();
19}
20add_filter( 'agents_manager_enabled_in_block_editor', 'wpcom_agents_manager_enable_in_block_editor' );