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::get_js_backend_inline_data( Uncanny_Automator{String} $hook )

Returns the JS object with dynamic data required in some backend pages


Parameters Parameters

$hook

(Required) The ID of the current page


Top ↑

Return Return

(array) The inline data


Source Source

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

	private function get_js_backend_inline_data( $hook ) {
		// Set default data
		$automator_backend_js = array(
			'ajax'      => array(
				'url'   => admin_url( 'admin-ajax.php' ),
				'nonce' => \wp_create_nonce( 'uncanny_automator' ),
			),
			'rest'      => array(
				'url'   => esc_url_raw( rest_url() . AUTOMATOR_REST_API_END_POINT ),
				'nonce' => \wp_create_nonce( 'wp_rest' ),
			),
			'i18n'      => array(
				'error'    => array(
					'request' => array(
						'badRequest'   => array(
							'title' => __( 'Bad request', 'uncanny-automator' ),
						),

						'accessDenied' => array(
							'title' => __( 'Access denied', 'uncanny-automator' ),
						),

						'notFound'     => array(
							'title' => __( 'Not found', 'uncanny-automator' ),
						),

						'timeout'      => array(
							'title' => __( 'Request timeout', 'uncanny-automator' ),
						),

						'serverError'  => array(
							'title' => __( 'Internal error', 'uncanny-automator' ),
						),

						'parserError'  => array(
							'title' => __( 'Parser error', 'uncanny-automator' ),
						),

						'generic'      => array(
							'title' => __( 'Unknown error', 'uncanny-automator' ),
						),
					),
				),
				'proLabel' => array(
					'pro' => __( 'Pro', 'uncanny-automator' ),
				),
				'notSaved' => __( 'Changes you made may not be saved.', 'uncanny-automator' ),
			),
			'debugging' => array(
				'enabled' => (bool) AUTOMATOR_DEBUG_MODE,
			),
		);

		// Filter data
		$automator_backend_js = apply_filters(
			'automator_assets_backend_js_data',
			$automator_backend_js,
			$hook
		);

		return $automator_backend_js;
	}