Give_API_Keys_Table::prepare_items PHP Method

prepare_items() public method

Setup the final data for the table
Since: 1.1
public prepare_items ( ) : void
return void
    public function prepare_items()
    {
        $columns = $this->get_columns();
        $hidden = array();
        // No hidden columns
        $sortable = array();
        // Not sortable... for now
        $this->_column_headers = array($columns, $hidden, $sortable, 'id');
        $data = $this->query();
        $total_items = $this->total_items();
        $this->items = $data;
        $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $this->per_page, 'total_pages' => ceil($total_items / $this->per_page)));
    }

Usage Example

/**
 * Display the API Keys
 *
 * @since       2.0
 * @return      void
 */
function give_api_callback()
{
    if (!current_user_can('manage_give_settings')) {
        return;
    }
    do_action('give_tools_api_keys_before');
    require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
    $api_keys_table = new Give_API_Keys_Table();
    $api_keys_table->prepare_items();
    $api_keys_table->display();
    ?>
	<p>
		<?php 
    printf(__('API keys allow users to use the <a href="%s">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%s">Zapier</a>.', 'give'), 'https://givewp.com/documentation/give-api-reference/', 'https://givewp.com/addons/zapier/');
    ?>
	</p>

	<style>
		.give_forms_page_give-settings .give-submit-wrap {
			display: none; /* Hide Save settings button on System Info Tab (not needed) */
		}
	</style>
	<?php 
    do_action('give_tools_api_keys_after');
}
All Usage Examples Of Give_API_Keys_Table::prepare_items