LLMS_REST_Table_API_Keys::get_data( string $key, LLMS_REST_API_Key $api_key )

Retrieve data for the columns


Parameters Parameters

$key

(string) (Required) the column id / key.

$api_key

(LLMS_REST_API_Key) (Required) API key object.


Top ↑

Return Return

(mixed)


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/admin/tables/class-llms-rest-table-api-keys.php

	public function get_data( $key, $api_key ) {

		switch ( $key ) {

			case 'description':
				$value = $this->get_description_cell( $api_key );
				break;

			case 'last_access':
				$value = $api_key->get_last_access_date();
				break;

			case 'truncated_key':
				$value = '<code>&hellip;' . $api_key->get( $key ) . '</code>';
				break;

			case 'user_id':
				$user = get_user_by( 'id', $api_key->get( $key ) );
				if ( ! $user ) {
					$value = '';
				} elseif ( current_user_can( 'edit_user', $user->ID ) ) {
					$value = '<a href="' . esc_url( get_edit_user_link( $user->ID ) ) . '">' . esc_html( $user->display_name ) . '</a>';
				} else {
					$value = esc_html( $user->display_name );
				}

				break;

			default:
				$value = $api_key->get( $key );

		}

		return $this->filter_get_data( $value, $key, $api_key );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.