Automattic\WooCommerce\EmailEditor\Engine

Settings_Controller::init_iframe_assetsprivateWC 1.0

Method to initialize iframe assets.

Method of the class: Settings_Controller{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->init_iframe_assets(): void;

Settings_Controller::init_iframe_assets() code WC 10.5.0

private function init_iframe_assets(): void {
	if ( ! empty( $this->iframe_assets ) ) {
		return;
	}

	$this->iframe_assets                = _wp_get_iframed_editor_assets();
	$this->allowed_iframe_style_handles = $this->get_allowed_iframe_style_handles();

	$cleaned_styles = array();
	foreach ( explode( "\n", (string) $this->iframe_assets['styles'] ) as $asset ) {
		foreach ( $this->allowed_iframe_style_handles as $handle ) {
			if ( strpos( $asset, $handle ) !== false ) {
				$cleaned_styles[] = $asset;
				break;
			}
		}
	}

	$this->iframe_assets['styles'] = implode( "\n", $cleaned_styles );
}