BP_Activity_oEmbed_Extension::modify_iframe( string $retval )
Modify various IFRAME-related items if embeds are allowed.
Description
HTML modified:
- Add sandbox="allow-top-navigation" attribute. This allows links to work within the iframe sandbox attribute.
JS modified:
- Remove IFRAME height restriction of 1000px. Fixes long embed items being truncated.
Parameters
- $retval
-
(Required) Current embed HTML.
Return
(string)
Source
File: bp-activity/classes/class-bp-activity-oembed-extension.php
public function modify_iframe( $retval ) {
// Add 'allow-top-navigation' to allow links to be clicked.
$retval = str_replace( 'sandbox="', 'sandbox="allow-top-navigation ', $retval );
// See /wp-includes/js/wp-embed.js.
if ( SCRIPT_DEBUG ) {
// Removes WP's hardcoded IFRAME height restriction.
$retval = str_replace( 'height = 1000;', 'height = height;', $retval );
// This is for the WP build minified version.
} else {
$retval = str_replace( 'g=1e3', 'g=g', $retval );
}
return $retval;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.6.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.