-
Notifications
You must be signed in to change notification settings - Fork 860
Agents Manager: Add filter to skip enqueue in block editor contexts #47248
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
Changes from all commits
e9537cd
6b3960a
7008746
c7fb1fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Significance: patch | ||
| Type: added | ||
|
|
||
| Agents Manager: Add `agents_manager_enqueue_in_block_editor` filter to allow preventing enqueue in block editor contexts. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -311,6 +311,23 @@ private function get_variant() { | |
| * @return bool | ||
| */ | ||
| private function is_enabled() { | ||
| // Allow environments (e.g. CIAB) to prevent loading in block editor contexts | ||
| // where agents-manager is already running from the parent page. | ||
| /** | ||
| * Filter whether to enqueue Agents Manager assets inside the block editor iframe. | ||
| * | ||
| * This allows environments that already run Agents Manager from the parent page | ||
| * to disable enqueueing a second instance within the block editor context. | ||
| * | ||
| * @param bool $enqueue_in_block_editor Whether to enqueue Agents Manager assets | ||
| * in the block editor iframe. Default true. | ||
| * | ||
| * @return bool Whether to enqueue Agents Manager assets in the block editor iframe. | ||
| */ | ||
| if ( $this->is_block_editor() && ! apply_filters( 'agents_manager_enqueue_in_block_editor', true ) ) { | ||
| return false; | ||
|
Comment on lines
+327
to
+328
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Never mind! I'm going to switch it to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is that an approval then? 🍏 ? @jom |
||
| } | ||
aaronfc marked this conversation as resolved.
Show resolved
Hide resolved
aaronfc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Full unified experience: Agents Manager with support guides, Help Center takeover, etc. | ||
| if ( apply_filters( 'agents_manager_use_unified_experience', false ) ) { | ||
| return true; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.