Ar_Model_Viewer_For_Woocommerce_Admin_Settings
in package
The admin-specific functionality in Settings of the plugin.
Defines the plugin name, version, and two hooks to enqueue the admin-facing stylesheet and JavaScript.
Tags
Table of Contents
Properties
- $logger : object
- The variable to call WooCommerce class logger.
- $plugin_name : string
- The ID of this plugin.
- $plugin_prefix : string
- The unique prefix of this plugin.
- $version : string
- The version of this plugin.
Methods
- __construct() : mixed
- Initialize the class and set its properties.
- ar_model_viewer_for_woocommerce_cmb2_after_row() : mixed
- ar_model_viewer_for_woocommerce_cmb2_settings() : mixed
- Define the metabox and field configurations.
- ar_model_viewer_for_woocommerce_get_model_preview_with_global_settings() : void
- Handles the retrieval of 3D model settings and product details via AJAX request.
- ar_model_viewer_for_woocommerce_get_model_to_preview_in_settings() : mixed
- get_model_3d_file_or_fallback() : string
- Retrieves the 3D model file for the product or falls back to a default file.
- get_ar_model_viewer_settings() : array<string|int, mixed>
- Retrieves AR model viewer settings from the options page.
- get_model_poster_or_fallback() : string
- Retrieves the 3D model poster URL or falls back to the default placeholder image.
Properties
$logger
The variable to call WooCommerce class logger.
private
object
$logger
The variable to call WooCommerce class logger.
Tags
$plugin_name
The ID of this plugin.
private
string
$plugin_name
The ID of this plugin.
Tags
$plugin_prefix
The unique prefix of this plugin.
private
string
$plugin_prefix
The string used to uniquely prefix technical functions of this plugin.
Tags
$version
The version of this plugin.
private
string
$version
The current version of this plugin.
Tags
Methods
__construct()
Initialize the class and set its properties.
public
__construct(string $plugin_name, string $plugin_prefix, string $version) : mixed
Parameters
- $plugin_name : string
-
The name of this plugin.
- $plugin_prefix : string
-
The unique prefix of this plugin.
- $version : string
-
The version of this plugin.
Tags
ar_model_viewer_for_woocommerce_cmb2_after_row()
public
static ar_model_viewer_for_woocommerce_cmb2_after_row(mixed $field_args, mixed $field) : mixed
Parameters
- $field_args : mixed
- $field : mixed
ar_model_viewer_for_woocommerce_cmb2_settings()
Define the metabox and field configurations.
public
ar_model_viewer_for_woocommerce_cmb2_settings() : mixed
ar_model_viewer_for_woocommerce_get_model_preview_with_global_settings()
Handles the retrieval of 3D model settings and product details via AJAX request.
public
ar_model_viewer_for_woocommerce_get_model_preview_with_global_settings() : void
This function is triggered by an AJAX request to get the 3D model settings and product details. It verifies the validity of the product ID, retrieves global settings, and prepares the data for response.
Tags
ar_model_viewer_for_woocommerce_get_model_to_preview_in_settings()
public
ar_model_viewer_for_woocommerce_get_model_to_preview_in_settings() : mixed
get_model_3d_file_or_fallback()
Retrieves the 3D model file for the product or falls back to a default file.
public
get_model_3d_file_or_fallback() : string
This function tries to get the 3D model file URL for a product. If the 3D model file is not available, it returns a default model file located in the 'admin/models/' directory. If the model file cannot be retrieved, it logs an error using the WooCommerce logger.
Tags
Return values
string —The URL of the 3D model file or an empty string if the file is missing.
get_ar_model_viewer_settings()
Retrieves AR model viewer settings from the options page.
private
get_ar_model_viewer_settings() : array<string|int, mixed>
This function gets the AR model viewer settings configured in the options page using CMB2.
Tags
Return values
array<string|int, mixed> —An array of AR model viewer settings.
get_model_poster_or_fallback()
Retrieves the 3D model poster URL or falls back to the default placeholder image.
private
get_model_poster_or_fallback() : string
This function is designed to retrieve the URL of the 3D model poster image. If the poster image is not found or doesn't exist, it returns a default placeholder image instead. In case there is an issue retrieving the image, the function logs an error using the WooCommerce logger.
Tags
Return values
string —The URL of the poster image or the fallback placeholder image.