WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#19974 closed enhancement (fixed)

WP_Screen help getter functions missing

Reported by: npetetin Owned by: nacin
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.3.1
Component: Administration Keywords: has-patch commit
Focuses: Cc:

Description

Please add getter functions in WP_Screen for help tab and sidebar:

public function get_help_tab( $id ) {
	return $this->_help_tabs[ $id ];
}
public function get_help_sidebar() {
	return $this->_help_sidebar;
}

Thanks.

Attachments (2)

19974.wp-screen-getters.diff (1.1 KB) - added by BenChapman 2 years ago.
Added getters to wp-admin/includes/screen.php
19974.diff (4.6 KB) - added by nacin 2 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 nacin2 years ago

  • Milestone changed from Awaiting Review to 3.4
  • Owner set to nacin
  • Status changed from new to accepted
  • Type changed from feature request to enhancement

BenChapman2 years ago

Added getters to wp-admin/includes/screen.php

comment:2 nacin2 years ago

When looking through this, I noticed that $id isn't actually used to key _help_tabs. (Note it's also _help_tabs, not _help_tab.) This is lame and is something we can get away with breaking compatibility on.

Attached, I'm adding get_help_tab(), get_help_tabs(), and get_help_sidebar(), and then using those helper methods elsewhere in the class.

nacin2 years ago

comment:3 nacin2 years ago

  • Keywords has-patch commit added

comment:5 nacin2 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In [19944]:

Add WP_Screen methods get_help_tabs(), get_help_tab( $id ), get_help_sidebar(). Store help tabs by tab ID, not numeric key; allows proper removal with remove_help_tab( $id ). props BenChapman, npetetin for initial getter patch. fixes #19974.

comment:6 npetetin2 years ago

Great!
Thanks.

comment:7 nacin2 years ago

In [19950]:

Add an @return. fixes #19974.

Note: See TracTickets for help on using tickets.