[wp-trac] [WordPress Trac] #47225: Add new actions to Site Health navigation

WordPress Trac noreply at wordpress.org
Sat Apr 17 00:08:52 UTC 2021


#47225: Add new actions to Site Health navigation
-------------------------------------------------+-------------------------
 Reporter:  ramiy                                |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  5.8
Component:  Site Health                          |     Version:  5.2
 Severity:  normal                               |  Resolution:
 Keywords:  site-health has-screenshots has-     |     Focuses:
  patch                                          |  administration
-------------------------------------------------+-------------------------
Changes (by Clorith):

 * version:   => 5.2
 * milestone:  Future Release => 5.8


Comment:

 [attachment:"47225.2.patch"] expands on the suggested approach from
 @ramiy.

 Since this needs to account for IE 11, which does not support dynamic grid
 columns. The patch allows for up to 4 items being displayed at once (which
 has shown itself to be a good number in the Health Check plugin).

 This is done by introducing a new `site_health_navigation_tabs` filter,
 taking an assocaited array of tab slugs and labels, as in the example
 below.

 {{{#!php
 $tabs = array(
         /* translators: Tab heading for Site Health Status page. */
         ''      => _x( 'Status', 'Site Health' ),
         /* translators: Tab heading for Site Health Info page. */
         'debug' => _x( 'Info', 'Site Health' ),
 );
 }}}


 This would lead to the example shown in [attachment:"4-menu-items.PNG"].

 If more than 4 menu items are present, then 3 items, and an ellipsis
 toggle is shown instead, as seen in [attachment:"5-menu-items-
 collapsed.PNG"], this maintains a predictable UI for the end user, without
 overloading the navigation (or requiring a lot of CSS, as each new tab we
 allow for needs custom CSS in place). Expanding everything leaves you with
 [attachment:"5-menu-items-expanded.PNG"].

 The actual content of the custom tab is then output with the new action
 `site_health_tab_content `, where the current tab is passed as the
 argument. This means that developers would also be able to extend each
 others tabs. And thanks to some quick refactoring to make sure core uses
 the same features for its debug information tab, also extend the debug
 page to their benefit if they wish to. The exception here is the initial
 Status tab, which does not trigger the tab action, but is extensible in
 other ways.

 Tab content that should be output would be whatever the developer wishes
 to output, there is no wrapper, so the full viewport width is available to
 them.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47225#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list