welcome_api->get_privacy_consent_logs(); if ( is_array( $data ) ) wp_send_json_success( $this->get_privacy_consent_logs_table( $data ) ); else wp_send_json_error( $data ); } /** * Get consent logs from specific date. * * @param array $data * * @return string */ public function get_privacy_consent_logs_table( $data ) { // include wp list table class if needed if ( ! class_exists( 'WP_List_Table' ) ) include_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); // include consent logs list table include_once( COOKIE_NOTICE_PATH . '/includes/privacy-consent-logs-list-table.php' ); // initialize list table $list_table = new Cookie_Notice_Privacy_Consent_Logs_List_Table( [ 'plural' => 'cn-privacy-consent-logs', 'singular' => 'cn-privacy-consent-log', 'ajax' => false ] ); // prepare data $list_table->cn_set_data( $data ); // prepare items $list_table->prepare_items(); ob_start(); $list_table->display(); $html = ob_get_clean(); return $html; } }