Summery Summery
Handles the name column output.
Syntax Syntax
Parameters Parameters
- $theme
-
(Required) The current WP_Theme object.
Source Source
File: wp-admin/includes/class-wp-ms-themes-list-table.php
);
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 ] = sprintf(
"<a href='%s'%s>%s</a>",
esc_url( add_query_arg( 'theme_status', $type, $url ) ),
( $type === $status ) ? ' class="current" aria-current="page"' : '',
sprintf( $text, number_format_i18n( $count ) )
);
}
}
return $status_links;
}
/**
* @global string $status
*
* @return array
*/
protected function get_bulk_actions() {
global $status;
$actions = array();
if ( 'enabled' !== $status ) {
$actions['enable-selected'] = $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' );
}
if ( 'disabled' !== $status ) {
$actions['disable-selected'] = $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' );
}
if ( ! $this->is_site_themes ) {
if ( current_user_can( 'update_themes' ) ) {
$actions['update-selected'] = __( 'Update' );
}
if ( current_user_can( 'delete_themes' ) ) {
$actions['delete-selected'] = __( 'Delete' );
}
}
if ( $this->show_autoupdates ) {
if ( 'auto-update-enabled' !== $status ) {
$actions['enable-auto-update-selected'] = __( 'Enable Auto-updates' );
}
if ( 'auto-update-disabled' !== $status ) {
$actions['disable-auto-update-selected'] = __( 'Disable Auto-updates' );
}
}
return $actions;
}
/**
*/
public function display_rows() {
foreach ( $this->items as $theme ) {
$this->single_row( $theme );
}
}
/**
* Handles the checkbox column output.
*
* @since 4.3.0
*
* @param WP_Theme $theme The current WP_Theme object.
*/
public function column_cb( $theme ) {
$checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
?>
<input type="checkbox" name="checked[]" value="<?php echo esc_attr( $theme->get_stylesheet() ); ?>" id="<?php echo $checkbox_id; ?>" />
<label class="screen-reader-text" for="<?php echo $checkbox_id; ?>" ><?php _e( 'Select' ); ?> <?php echo $theme->display( 'Name' ); ?></label>
<?php
}
/**
* Handles the name column output.
*
* @since 4.3.0
*
* @global string $status
* @global int $page
* @global string $s
*
* @param WP_Theme $theme The current WP_Theme object.
*/
public function column_name( $theme ) {
global $status, $page, $s;
$context = $status;
if ( $this->is_site_themes ) {
$url = "site-themes.php?id={$this->site_id}&";
$allowed = $theme->is_allowed( 'site', $this->site_id );
} else {
$url = 'themes.php?';
$allowed = $theme->is_allowed( 'network' );
}
// Pre-order.
$actions = array(
'enable' => '',
'disable' => '',
'delete' => '',
);
$stylesheet = $theme->get_stylesheet();
$theme_key = urlencode( $stylesheet );
if ( ! $allowed ) {
if ( ! $theme->errors() ) {
$url = add_query_arg(
array(
'action' => 'enable',
'theme' => $theme_key,
'paged' => $page,
's' => $s,
),
$url
);
if ( $this->is_site_themes ) {
/* translators: %s: Theme name. */
$aria_label = sprintf( __( 'Enable %s' ), $theme->display( 'Name' ) );
} else {
Advertisement
Changelog Changelog
| Version | Description |
|---|---|
| 4.3.0 | Introduced. |