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::dashboard_inline_js_data()
Adds required JS data for the Dashboard page. Before doing so, checks if the current page is indeed the Dashboard page.
Contents
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 dashboard_inline_js_data() { // Filter inline data add_filter( 'automator_assets_backend_js_data', function ( $data, $hook ) { // Check if the current page is the "Dashboard" page if ( 'uo-recipe_page_uncanny-automator-dashboard' === (string) $hook ) { // Get data about the connected site $this->automator_connect = self::is_automator_connected(); // Check if the user has Automator Pro $is_pro_active = false; if ( isset( $this->automator_connect['item_name'] ) ) { if ( defined( 'AUTOMATOR_PRO_ITEM_NAME' ) && AUTOMATOR_PRO_ITEM_NAME === $this->automator_connect['item_name'] ) { $is_pro_active = true; } } // Add it to the main JS variable $data['isPro'] = $is_pro_active; // Check if the site is connected $data['hasSiteConnected'] = $this->automator_connect ? true : false; // Add strings $data['i18n']['credits'] = array( 'recipesUsingCredits' => array( 'noRecipes' => __( 'No recipes using credits on this site', 'uncanny-automator' ), 'table' => array( 'recipe' => __( 'Recipe', 'uncanny-automator' ), 'completionsAllowed' => __( 'Completions allowed', 'uncanny-automator' ), 'completedRuns' => __( 'Completed runs', 'uncanny-automator' ), /* translators: 1. Number */ 'perUser' => __( 'Per user: %1$s', 'uncanny-automator' ), /* translators: 1. Number */ 'total' => __( 'Total: %1$s', 'uncanny-automator' ), /* translators: Unlimited times */ 'unlimited' => _x( 'Unlimited', 'Times', 'uncanny-automator' ), ), ), ); } return $data; }, 10, 2 ); }
Expand full source code Collapse full source code View on Github