'; echo esc_html__( 'Agentyllo admin assets are not built. Run "npm install && npm run build" in the plugin repository.', 'agentyllo' ); echo '

'; } ); return; } $asset = require $asset_file; wp_enqueue_script( self::HANDLE, AGYL_URL . 'assets/build/admin.js', $asset['dependencies'] ?? array(), $asset['version'] ?? AGYL_VERSION, true ); wp_enqueue_style( 'wp-components' ); $style = is_rtl() ? 'style-admin-rtl.css' : 'style-admin.css'; if ( file_exists( AGYL_DIR . 'assets/build/' . $style ) ) { wp_enqueue_style( self::HANDLE, AGYL_URL . 'assets/build/' . $style, array( 'wp-components' ), $asset['version'] ?? AGYL_VERSION ); } wp_set_script_translations( self::HANDLE, 'agentyllo', AGYL_DIR . 'languages' ); wp_add_inline_script( self::HANDLE, 'window.agylAdmin = ' . wp_json_encode( array( // Site REST root (works with plain and pretty permalinks); // the JS layer prefixes paths with /agentyllo/v1. 'restRoot' => esc_url_raw( rest_url() ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'version' => AGYL_VERSION, ) ) . ';', 'before' ); } }