*/ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Opalestate_Field_Iconpicker { /** * Current version number */ const VERSION = '1.0.0'; /** * Initialize the plugin by hooking into CMB2 */ public static function init() { add_filter( 'cmb2_render_opal_iconpicker', [ __CLASS__, 'render_iconpicker' ], 10, 5 ); add_filter( 'cmb2_sanitize_opal_iconpicker', [ __CLASS__, 'sanitize_map' ], 10, 4 ); } /** * Render field */ public static function render_iconpicker( $field, $field_escaped_value, $field_object_id, $field_object_type, $field_type_object ) { self::setup_admin_scripts(); $users = $field->value; echo '
'; ?>

'; } /** * Optionally save the latitude/longitude values into two custom fields */ public static function sanitize_map( $override_value, $value, $object_id, $field_args ) { return $value; } /** * Enqueue scripts and styles */ public static function setup_admin_scripts() { wp_enqueue_script( 'opalestate-adduser', plugins_url( 'assets/script.js', __FILE__ ), [], self::VERSION ); wp_enqueue_style( 'opalestate-adduser', plugins_url( 'assets/style.css', __FILE__ ), [], self::VERSION ); } } Opalestate_Field_Iconpicker::init();