WC_Admin_API_Keys_Table_List::column_title()
Return title column.
Method of the class: WC_Admin_API_Keys_Table_List{}
No Hooks.
Return
String
.
Usage
$WC_Admin_API_Keys_Table_List = new WC_Admin_API_Keys_Table_List(); $WC_Admin_API_Keys_Table_List->column_title( $key );
- $key(array) (required)
- Key data.
WC_Admin_API_Keys_Table_List::column_title() WC Admin API Keys Table List::column title code WC 9.4.2
public function column_title( $key ) { $url = admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=keys&edit-key=' . $key['key_id'] ); $user_id = intval( $key['user_id'] ); // Check if current user can edit other users or if it's the same user. $can_edit = current_user_can( 'edit_user', $user_id ) || get_current_user_id() === $user_id; $output = '<strong>'; if ( $can_edit ) { $output .= '<a href="' . esc_url( $url ) . '" class="row-title">'; } if ( empty( $key['description'] ) ) { $output .= esc_html__( 'API key', 'woocommerce' ); } else { $output .= esc_html( $key['description'] ); } if ( $can_edit ) { $output .= '</a>'; } $output .= '</strong>'; // Get actions. $actions = array( /* translators: %s: API key ID. */ 'id' => sprintf( __( 'ID: %d', 'woocommerce' ), $key['key_id'] ), ); if ( $can_edit ) { $actions['edit'] = '<a href="' . esc_url( $url ) . '">' . __( 'View/Edit', 'woocommerce' ) . '</a>'; $actions['trash'] = '<a class="submitdelete" aria-label="' . esc_attr__( 'Revoke API key', 'woocommerce' ) . '" href="' . esc_url( wp_nonce_url( add_query_arg( array( 'revoke-key' => $key['key_id'], ), admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=keys' ) ), 'revoke' ) ) . '">' . esc_html__( 'Revoke', 'woocommerce' ) . '</a>'; } $row_actions = array(); foreach ( $actions as $action => $link ) { $row_actions[] = '<span class="' . esc_attr( $action ) . '">' . $link . '</span>'; } $output .= '<div class="row-actions">' . implode( ' | ', $row_actions ) . '</div>'; return $output; }