Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Admin_Assets::block_editor_assets_for_certificates()

Enqueue block editor assets for certificate post types.


Return Return

(void)


Top ↑

Source Source

File: includes/admin/class.llms.admin.assets.php

	private function block_editor_assets_for_certificates() {

		llms()->assets->enqueue_script( 'llms-admin-certificate-editor' );

		$settings = array(
			'default_image' => llms()->certificates()->get_default_image( get_the_ID() ),
			'sizes'         => llms_get_certificate_sizes(),
			'orientations'  => llms_get_certificate_orientations(),
			'units'         => llms_get_certificate_units(),
			'colors'        => array(
				array(
					'name'  => __( 'White', 'lifterlms' ),
					'slug'  => 'white',
					'color' => '#ffffff',
				),
				array(
					'name'  => __( 'White Smoke', 'lifterlms' ),
					'slug'  => 'white-smoke',
					'color' => '#f5f5f5',
				),
				array(
					'name'  => __( 'Ivory', 'lifterlms' ),
					'slug'  => 'ivory',
					'color' => '#fffff0',
				),
			),
			'merge_codes'   => llms_get_certificate_merge_codes(),
		);
		llms()->assets->enqueue_inline(
			'llms-admin-certificate-settings',
			"window.llms = window.llms || {};window.llms.certificates=JSON.parse( '" . wp_slash( wp_json_encode( $settings ) ) . "' );",
			'footer'
		);

		global $wp_version;
		$supports_fonts = version_compare( $wp_version, '5.9-src', '>=' );

		$fonts = $supports_fonts ? llms_get_certificate_fonts() : new stdClass();

		$styles = '';
		foreach ( $fonts as $id => $data ) {

			if ( ! empty( $data['href'] ) ) {
				wp_enqueue_style( 'llms-font-' . $id, $data['href'], array(), LLMS_VERSION );
			}

			$css     = $data['fontFamily'];
			$styles .= ".editor-styles-wrapper .has-{$id}-font-family { font-family: {$css} !important }\n";
		}

		llms()->assets->enqueue_inline(
			'llms-admin-certificate-styles',
			$styles,
			'style'
		);

	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.5.0 Use wp_slash() after wp_json_encode() to prevent issues encountered when strings contain single quotes.
6.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.