File "Google_Product_Category_Field.php"

Full Path: /home/vantageo/public_html/cache/cache/cache/cache/.wp-cli/wp-content/plugins/facebook-for-woocommerce/includes/Admin/Google_Product_Category_Field.php
File size: 1.03 KB
MIME-type: text/x-php
Charset: utf-8

<?php
/**
 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
 *
 * This source code is licensed under the license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @package FacebookCommerce
 */

namespace WooCommerce\Facebook\Admin;

defined( 'ABSPATH' ) || exit;

/**
 * Google product category field.
 *
 * @since 2.1.0
 */
class Google_Product_Category_Field {

	/**
	 * Instantiates the JS handler for the Google product category field.
	 *
	 * @since 2.1.0
	 *
	 * @param string $input_id element that should receive the latest concrete category ID value.
	 */
	public function render( $input_id ) {
		$facebook_category_handler = facebook_for_woocommerce()->get_facebook_category_handler();
		$facebook_category_fields  = sprintf(
			"window.wc_facebook_google_product_category_fields = new WC_Facebook_Google_Product_Category_Fields( %s, '%s' );",
			wp_json_encode( $facebook_category_handler->get_categories() ),
			esc_js( $input_id )
		);
		wc_enqueue_js( $facebook_category_fields );
	}
}