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.

Admin_Menu::integrations_inline_js_data()

Adds required JS data for the Integrations page. Before doing so, checks if the current page is indeed the Integrations page.


Description Description

This uses the filter "automator_assets_backend_js_data". If the page is not the targeted page, it just returns the data unmodified.


Source Source

File: src/core/admin/class-admin-menu.php

	private function integrations_inline_js_data() {
		// Filter inline data
		add_filter(
			'automator_assets_backend_js_data',
			function ( $data, $hook ) {
				// Check if the current page is the "Integrations" page
				if ( 'uo-recipe_page_uncanny-automator-integrations' === (string) $hook ) {
					// Check if integrations are already loaded in transient.
					$integrations = get_transient( 'uo-automator-integration-items' );
					if ( false === $integrations ) {
						$integrations = $this->get_integrations();
					}
					// Check if integrations' collections are already loaded in transient.
					$collections = get_transient( 'uo-automator-integration-collection-items' );
					if ( false === $collections ) {
						$collections = $this->get_collections();
					}
					// Add integrations
					$data['integrations'] = $integrations;
					$data['collections']  = $collections;
				}
				return $data;
			},
			10,
			2
		);
	}