WP_MS_Themes_List_Table::column_name() – Handles the name column output.

You appear to be a bot. Output may be restricted

Description

Handles the name column output.

Usage

WP_MS_Themes_List_Table::column_name( $theme );

Parameters

$theme
( WP_Theme ) required – The current WP_Theme object.

Returns

void

Source

File name: wordpress/wp-admin/includes/class-wp-ms-themes-list-table.php
Lines:

1 to 100 of 145
  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 {
          /* translators: %s: Theme name. */
          $aria_label = sprintf( __( 'Network Enable %s' ), $theme->display( 'Name' ) );
        }

        $actions['enable'] = sprintf(
          '<a href="%s" class="edit" aria-label="%s">%s</a>',
          esc_url( wp_nonce_url( $url, 'enable-theme_' . $stylesheet ) ),
          esc_attr( $aria_label ),
          ( $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ) )
        );
      }
    } else {
      $url = add_query_arg(
        array(
          'action' => 'disable',
          'theme'  => $theme_key,
          'paged'  => $page,
          's'      => $s,
        ),
        $url
      );

      if ( $this->is_site_themes ) {
        /* translators: %s: Theme name. */
        $aria_label = sprintf( __( 'Disable %s' ), $theme->display( 'Name' ) );
      } else {
        /* translators: %s: Theme name. */
        $aria_label = sprintf( __( 'Network Disable %s' ), $theme->display( 'Name' ) );
      }

      $actions['disable'] = sprintf(
        '<a href="%s" aria-label="%s">%s</a>',
        esc_url( wp_nonce_url( $url, 'disable-theme_' . $stylesheet ) ),
        esc_attr( $aria_label ),
        ( $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ) )
      );
    }

    if ( ! $allowed && ! $this->is_site_themes
      && current_user_can( 'delete_themes' )
      && get_option( 'stylesheet' ) !== $stylesheet
      && get_option( 'template' ) !== $stylesheet
    ) {
      $url = add_query_arg(
        array(
          'action'       => 'delete-selected',
          'checked[]'    => $theme_key,
          'theme_status' => $context,
          'paged'        => $page,
          's'            => $s,
        ),
        'themes.php'
      );

      /* translators: %s: Theme name. */
      $aria_label = sprintf( _x( 'Delete %s', 'theme' ), $theme->display( 'Name' ) );

      $actions['delete'] = sprintf(
        '<a href="%s" class="delete" aria-label="%s">%s</a>',
        esc_url( wp_nonce_url( $url, 'bulk-themes' ) ),
        esc_attr( $aria_label ),
 

 View on GitHub View on Trac