WordPress at a glance
function is not described

WP_MS_Sites_List_Table::site_states() protected WP 5.3.0

Maybe output comma-separated site states.

{} It's a method of the class: WP_MS_Sites_List_Table{}

Hooks from the method
Return

Null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->site_states( $site );
$site(array) (required)

Changelog

Since 5.3.0 Introduced.

Code of WP_MS_Sites_List_Table::site_states() WP 5.5.2

<?php
protected function site_states( $site ) {
	$site_states = array();

	// $site is still an array, so get the object.
	$_site = WP_Site::get_instance( $site['blog_id'] );

	if ( is_main_site( $_site->id ) ) {
		$site_states['main'] = __( 'Main' );
	}

	reset( $this->status_list );

	$site_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
	foreach ( $this->status_list as $status => $col ) {
		if ( ( 1 === intval( $_site->{$status} ) ) && ( $site_status !== $status ) ) {
			$site_states[ $col[0] ] = $col[1];
		}
	}

	/**
	 * Filter the default site display states for items in the Sites list table.
	 *
	 * @since 5.3.0
	 *
	 * @param array $site_states An array of site states. Default 'Main',
	 *                           'Archived', 'Mature', 'Spam', 'Deleted'.
	 * @param WP_Site $site The current site object.
	 */
	$site_states = apply_filters( 'display_site_states', $site_states, $_site );

	if ( ! empty( $site_states ) ) {
		$state_count = count( $site_states );
		$i           = 0;
		echo ' &mdash; ';
		foreach ( $site_states as $state ) {
			++$i;
			( $i == $state_count ) ? $sep = '' : $sep = ', ';
			echo "<span class='post-state'>{$state}{$sep}</span>";
		}
	}
}