register_control_type( 'Epsilon_Control_Icon_Picker' ); } /** * @since 1.0.0 * @return array */ public function json() { $json = parent::json(); $json['id'] = $this->id; $json['link'] = $this->get_link(); $json['value'] = $this->value(); $json['icons'] = $this->get_icons(); return $json; } /** * @since 1.0.0 * @return mixed */ public function get_icons() { global $wp_filesystem; if ( empty( $wp_filesystem ) ) { require_once( ABSPATH . '/wp-admin/includes/file.php' ); WP_Filesystem(); } $path = $this->icons; /** * In case we don`t have path to icons, we load our own library */ if ( empty( $this->icons ) || ! file_exists( $path ) ) { $path = EPSILON_PATH . '/assets/data/icons.json'; } $icons = $wp_filesystem->get_contents( $path ); $icons = json_decode( $icons ); /** * In case the json could not be decoded, we return a new stdClass */ if ( null === $icons ) { return new stdClass(); } return $icons; } /** * Display the control's content */ public function content_template() { //@formatter:off ?>