WP_Application_Passwords_List_Table::print_js_template_row() WordPress Method
The WP_Application_Passwords_List_Table::print_js_template_row() method is used to generate a table row for a new application password. It sets up the default values for each column and outputs the row HTML.
WP_Application_Passwords_List_Table::print_js_template_row() #
Prints the JavaScript template for the new row item.
Source
File: wp-admin/includes/class-wp-application-passwords-list-table.php
public function print_js_template_row() { list( $columns, $hidden, , $primary ) = $this->get_column_info(); echo '<tr data-uuid="{{ data.uuid }}">'; foreach ( $columns as $column_name => $display_name ) { $is_primary = $primary === $column_name; $classes = "{$column_name} column-{$column_name}"; if ( $is_primary ) { $classes .= ' has-row-actions column-primary'; } if ( in_array( $column_name, $hidden, true ) ) { $classes .= ' hidden'; } printf( '<td class="%s" data-colname="%s">', esc_attr( $classes ), esc_attr( wp_strip_all_tags( $display_name ) ) ); switch ( $column_name ) { case 'name': echo '{{ data.name }}'; break; case 'created': // JSON encoding automatically doubles backslashes to ensure they don't get lost when printing the inline JS. echo '<# print( wp.date.dateI18n( ' . wp_json_encode( __( 'F j, Y' ) ) . ', data.created ) ) #>'; break; case 'last_used': echo '<# print( data.last_used !== null ? wp.date.dateI18n( ' . wp_json_encode( __( 'F j, Y' ) ) . ", data.last_used ) : '—' ) #>"; break; case 'last_ip': echo "{{ data.last_ip || '—' }}"; break; case 'revoke': printf( '<button type="button" class="button delete" aria-label="%1$s">%2$s</button>', /* translators: %s: the application password's given name. */ esc_attr( sprintf( __( 'Revoke "%s"' ), '{{ data.name }}' ) ), esc_html__( 'Revoke' ) ); break; default: /** * Fires in the JavaScript row template for each custom column in the Application Passwords list table. * * Custom columns are registered using the {@see 'manage_application-passwords-user_columns'} filter. * * @since 5.6.0 * * @param string $column_name Name of the custom column. */ do_action( "manage_{$this->screen->id}_custom_column_js_template", $column_name ); break; } if ( $is_primary ) { echo '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>'; } echo '</td>'; } echo '</tr>'; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.6.0 | Introduced. |