Make WordPress Core


Ignore:
Timestamp:
07/29/2020 07:59:30 PM (5 years ago)
Author:
whyisjake
Message:

Upgrade/Install: Only show auto-update for themes that support the feature.

Similar to the changes for plugins in [48669], let's only show the UI for themes when updates are supported for that theme.

See #50280.
Props dd32.

File:
1 edited

Legend:

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

    r48659 r48688  
    676676    $template = '
    677677        <div class="theme-autoupdate">
    678             <# if ( data.autoupdate ) { #>
    679                 <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="disable">
    680                     <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Disable auto-updates' ) . '</span>
    681                 </button>
    682             <# } else { #>
    683                 <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="enable">
    684                     <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Enable auto-updates' ) . '</span>
    685                 </button>
     678            <# if ( data.autoupdate.supported ) { #>
     679                <# if ( data.autoupdate.forced === false ) { #>
     680                    ' . __( 'Auto-updates disabled' ) . '
     681                <# } else if ( data.autoupdate.forced ) { #>
     682                    ' . __( 'Auto-updates enabled' ) . '
     683                <# } else if ( data.autoupdate.enabled ) { #>
     684                    <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="disable">
     685                        <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Disable auto-updates' ) . '</span>
     686                    </button>
     687                <# } else { #>
     688                    <button type="button" class="toggle-auto-update button-link" data-slug="{{ data.id }}" data-wp-action="enable">
     689                        <span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span><span class="label">' . __( 'Enable auto-updates' ) . '</span>
     690                    </button>
     691                <# } #>
    686692            <# } #>
    687693            <# if ( data.hasUpdate ) { #>
    688                 <# if ( data.autoupdate ) { #>
     694                <# if ( data.autoupdate.supported && data.autoupdate.enabled ) { #>
    689695                    <span class="auto-update-time">
    690696                <# } else { #>
Note: See TracChangeset for help on using the changeset viewer.