WP_MS_Themes_List_Table::get_views()protectedWP 1.0

Method of the class: WP_MS_Themes_List_Table{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_views();

Notes

  • Global. Array. $totals
  • Global. String. $status

WP_MS_Themes_List_Table::get_views() code WP 6.6.2

protected function get_views() {
	global $totals, $status;

	$status_links = array();
	foreach ( $totals as $type => $count ) {
		if ( ! $count ) {
			continue;
		}

		switch ( $type ) {
			case 'all':
				/* translators: %s: Number of themes. */
				$text = _nx(
					'All <span class="count">(%s)</span>',
					'All <span class="count">(%s)</span>',
					$count,
					'themes'
				);
				break;
			case 'enabled':
				/* translators: %s: Number of themes. */
				$text = _nx(
					'Enabled <span class="count">(%s)</span>',
					'Enabled <span class="count">(%s)</span>',
					$count,
					'themes'
				);
				break;
			case 'disabled':
				/* translators: %s: Number of themes. */
				$text = _nx(
					'Disabled <span class="count">(%s)</span>',
					'Disabled <span class="count">(%s)</span>',
					$count,
					'themes'
				);
				break;
			case 'upgrade':
				/* translators: %s: Number of themes. */
				$text = _nx(
					'Update Available <span class="count">(%s)</span>',
					'Update Available <span class="count">(%s)</span>',
					$count,
					'themes'
				);
				break;
			case 'broken':
				/* translators: %s: Number of themes. */
				$text = _nx(
					'Broken <span class="count">(%s)</span>',
					'Broken <span class="count">(%s)</span>',
					$count,
					'themes'
				);
				break;
			case 'auto-update-enabled':
				/* translators: %s: Number of themes. */
				$text = _n(
					'Auto-updates Enabled <span class="count">(%s)</span>',
					'Auto-updates Enabled <span class="count">(%s)</span>',
					$count
				);
				break;
			case 'auto-update-disabled':
				/* translators: %s: Number of themes. */
				$text = _n(
					'Auto-updates Disabled <span class="count">(%s)</span>',
					'Auto-updates Disabled <span class="count">(%s)</span>',
					$count
				);
				break;
		}

		if ( $this->is_site_themes ) {
			$url = 'site-themes.php?id=' . $this->site_id;
		} else {
			$url = 'themes.php';
		}

		if ( 'search' !== $type ) {
			$status_links[ $type ] = array(
				'url'     => esc_url( add_query_arg( 'theme_status', $type, $url ) ),
				'label'   => sprintf( $text, number_format_i18n( $count ) ),
				'current' => $type === $status,
			);
		}
	}

	return $this->get_views_links( $status_links );
}