MailPoet\EmailEditor\Engine

Settings_Controller::init_iframe_assets()privateWC 1.0

Method to initialize iframe assets.

Method of the class: Settings_Controller{}

No Hooks.

Return

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 9.8.1

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

	$this->iframe_assets = _wp_get_iframed_editor_assets();

	// Remove layout styles and block library for classic themes. They are added only when a classic theme is active
	// and they add unwanted margins and paddings in the editor content.
	$cleaned_styles = array();
	foreach ( explode( "\n", (string) $this->iframe_assets['styles'] ) as $asset ) {
		if ( strpos( $asset, 'wp-editor-classic-layout-styles-css' ) !== false ) {
			continue;
		}
		if ( strpos( $asset, 'wp-block-library-theme-css' ) !== false ) {
			continue;
		}
		$cleaned_styles[] = $asset;
	}
	$this->iframe_assets['styles'] = implode( "\n", $cleaned_styles );
}