Make WordPress Core


Ignore:
Timestamp:
06/17/2020 11:58:15 PM (6 years ago)
Author:
azaozz
Message:

Plugins and Themes Auto-Updates: allow overriding of the HTML for the auto-update setting link. This will let plugins show better/specific information when they are overriding the auto-update settings, for example "Updates are managed by ... plugin".

Introduces: theme_auto_update_setting_html, plugin_auto_update_setting_html, and theme_auto_update_setting_template filters.

Props audrasjb, pbiron, azaozz.
Fixes #50280.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-ms-themes-list-table.php

    r47910 r48077  
    743743        $url = add_query_arg( $query_args, 'themes.php' );
    744744
    745         printf(
     745        $html[] = sprintf(
    746746            '<a href="%s" class="toggle-auto-update" data-wp-action="%s">',
    747747            wp_nonce_url( $url, 'updates' ),
     
    749749        );
    750750
    751         echo '<span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span>';
    752         echo '<span class="label">' . $text . '</span>';
    753         echo '</a>';
     751        $html[] = '<span class="dashicons dashicons-update spin hidden" aria-hidden="true"></span>';
     752        $html[] = '<span class="label">' . $text . '</span>';
     753        $html[] = '</a>';
    754754
    755755        $available_updates = get_site_transient( 'update_themes' );
    756756        if ( isset( $available_updates->response[ $stylesheet ] ) ) {
    757             printf(
     757            $html[] = sprintf(
    758758                '<div class="auto-update-time%s">%s</div>',
    759759                $time_class,
     
    761761            );
    762762        }
     763
     764        $html = implode( '', $html );
     765
     766        /**
     767         * Filters the HTML of the auto-updates setting for each theme in the Themes list table.
     768         *
     769         * @since 5.5.0
     770         *
     771         * @param string   $html       The HTML for theme’s auto-update setting including toggle auto-update action link
     772         *                             and time to next update.
     773         * @param string   $stylesheet Directory name of the theme.
     774         * @param WP_Theme $theme      WP_Theme object.
     775         */
     776        echo apply_filters( 'theme_auto_update_setting_html', $html, $stylesheet, $theme );
     777
    763778        echo '<div class="auto-updates-error inline notice error hidden"><p></p></div>';
    764779    }
Note: See TracChangeset for help on using the changeset viewer.