WP_MS_Themes_List_Table::single_row_columns()publicWP 4.3.0

Handles the output for a single table row.

Method of the class: WP_MS_Themes_List_Table{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_MS_Themes_List_Table = new WP_MS_Themes_List_Table();
$WP_MS_Themes_List_Table->single_row_columns( $item );
$item(WP_Theme) (required)
The current WP_Theme object.

Changelog

Since 4.3.0 Introduced.

WP_MS_Themes_List_Table::single_row_columns() code WP 6.6.2

public function single_row_columns( $item ) {
	list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();

	foreach ( $columns as $column_name => $column_display_name ) {
		$extra_classes = '';
		if ( in_array( $column_name, $hidden, true ) ) {
			$extra_classes .= ' hidden';
		}

		switch ( $column_name ) {
			case 'cb':
				echo '<th scope="row" class="check-column">';

				$this->column_cb( $item );

				echo '</th>';
				break;

			case 'name':
				$active_theme_label = '';

				/* The presence of the site_id property means that this is a subsite view and a label for the active theme needs to be added */
				if ( ! empty( $this->site_id ) ) {
					$stylesheet = get_blog_option( $this->site_id, 'stylesheet' );
					$template   = get_blog_option( $this->site_id, 'template' );

					/* Add a label for the active template */
					if ( $item->get_template() === $template ) {
						$active_theme_label = ' &mdash; ' . __( 'Active Theme' );
					}

					/* In case this is a child theme, label it properly */
					if ( $stylesheet !== $template && $item->get_stylesheet() === $stylesheet ) {
						$active_theme_label = ' &mdash; ' . __( 'Active Child Theme' );
					}
				}

				echo "<td class='theme-title column-primary{$extra_classes}'><strong>" . $item->display( 'Name' ) . $active_theme_label . '</strong>';

				$this->column_name( $item );

				echo '</td>';
				break;

			case 'description':
				echo "<td class='column-description desc{$extra_classes}'>";

				$this->column_description( $item );

				echo '</td>';
				break;

			case 'auto-updates':
				echo "<td class='column-auto-updates{$extra_classes}'>";

				$this->column_autoupdates( $item );

				echo '</td>';
				break;
			default:
				echo "<td class='$column_name column-$column_name{$extra_classes}'>";

				$this->column_default( $item, $column_name );

				echo '</td>';
				break;
		}
	}
}