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.

Premium_Integrations::enqueue_assets()

Enqueue the assets


Source

File: src/core/lib/settings/trait-premium-integrations.php

	private function enqueue_assets() {
		// Check if there are assets defined
		if ( ! $this->get_css() && ! $this->get_js() ) {
			return;
		}

		// Enqueue assets
		add_action(
			'admin_enqueue_scripts',
			function () {
				// Only enqueue the assets of this integration on its own settings page
				if ( ! $this->is_current_page_settings() ) {
					return;
				}

				// Enqueue the CSS
				if ( $this->get_css() ) {
					wp_enqueue_style(
						'uap-premium-integration-' . $this->get_id(),
						plugins_url( '/src/integrations/' . $this->get_css(), AUTOMATOR_BASE_FILE ),
						array( 'uap-admin' ),
						AUTOMATOR_PLUGIN_VERSION
					);
				}

				// Enqueue the JS
				if ( $this->get_js() ) {
					wp_enqueue_script(
						'uap-premium-integration-' . $this->get_id(),
						plugins_url( '/src/integrations/' . $this->get_js(), AUTOMATOR_BASE_FILE ),
						array( 'uap-admin' ),
						AUTOMATOR_PLUGIN_VERSION,
						true
					);
				}
			}
		);
	}