Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add title attribute to button for Request panel with extra query var #782

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion dispatchers/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,14 @@ protected function before_output() {
* @return void
*/
protected function do_panel_menu_item( $id, array $menu ) {
if ( empty( $menu['attr-title'] ) ) {
$menu['attr-title'] = '';
}

printf(
'<li role="presentation"><button role="tab" data-qm-href="%1$s">%2$s</button>',
'<li role="presentation"><button role="tab" data-qm-href="%1$s" title="%2$s">%3$s</button>',
esc_attr( $menu['href'] ),
esc_attr( $menu['attr-title'] ),
esc_html( $menu['title'] )
);

Expand Down
9 changes: 9 additions & 0 deletions output/html/request.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,20 @@ public function admin_menu( array $menu ) {
/* translators: %s: Number of additional query variables */
: __( 'Request (+%s)', 'query-monitor' );

$attr_title = ( empty( $count ) )
? ''
/* translators: %s: Number of additional query variables */
: __( '+%s non-standard query variables in request. See Query Vars section.', 'query-monitor' );

$menu[ $this->collector->id() ] = $this->menu( array(
'title' => esc_html( sprintf(
$title,
number_format_i18n( $count )
) ),
'attr-title' => esc_html( sprintf(
$attr_title,
number_format_i18n( $count )
) ),
) );
return $menu;

Expand Down