Make WordPress Core


Ignore:
Timestamp:
02/27/2025 11:02:47 PM (10 months ago)
Author:
audrasjb
Message:

Themes: Fix inconstancies between theme and plugin editor.

This updates the header area of the theme and plugin file editor screen to make them more consistent. It now displays the name of theme or plugin, the active or inactive state, and the path to the file that is selected.

Props karmatosed, poena, audrasjb.
Fixes #41142.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/plugin-editor.php

    r57854 r59884  
    8585$file      = validate_file_to_edit( $file, $plugin_files );
    8686$real_file = WP_PLUGIN_DIR . '/' . $file;
     87
     88$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_files[0] );
     89$plugin_name = $plugin_data['Name'];
    8790
    8891// Handle fallback editing of file when JavaScript is not available.
     
    221224    if ( is_plugin_active( $plugin ) ) {
    222225        if ( is_writable( $real_file ) ) {
    223             /* translators: %s: Plugin file name. */
    224             printf( __( 'Editing %s (active)' ), '<strong>' . esc_html( $file ) . '</strong>' );
     226            /* translators: %s: Plugin name. */
     227            printf( __( 'Editing %s (active)' ), '<strong>' . esc_html( $plugin_name ) . '</strong>' );
    225228        } else {
    226             /* translators: %s: Plugin file name. */
    227             printf( __( 'Browsing %s (active)' ), '<strong>' . esc_html( $file ) . '</strong>' );
     229            /* translators: %s: Plugin name. */
     230            printf( __( 'Browsing %s (active)' ), '<strong>' . esc_html( $plugin_name ) . '</strong>' );
    228231        }
    229232    } else {
    230233        if ( is_writable( $real_file ) ) {
    231             /* translators: %s: Plugin file name. */
    232             printf( __( 'Editing %s (inactive)' ), '<strong>' . esc_html( $file ) . '</strong>' );
     234            /* translators: %s: Plugin name. */
     235            printf( __( 'Editing %s (inactive)' ), '<strong>' . esc_html( $plugin_name ) . '</strong>' );
    233236        } else {
    234             /* translators: %s: Plugin file name. */
    235             printf( __( 'Browsing %s (inactive)' ), '<strong>' . esc_html( $file ) . '</strong>' );
     237            /* translators: %s: Plugin name. */
     238            printf( __( 'Browsing %s (inactive)' ), '<strong>' . esc_html( $plugin_name ) . '</strong>' );
    236239        }
    237240    }
    238241    ?>
    239242</h2>
     243<?php
     244printf(
     245    /* translators: %s: File path. */
     246    ' <span><strong>' . __( 'File: %s' ) . '</strong></span>',
     247    esc_html( $file )
     248);
     249?>
    240250</div>
    241251<div class="alignright">
Note: See TracChangeset for help on using the changeset viewer.