Skip to content

Commit 92cdde1

Browse files
committed
Add help tabs support
1 parent 173f5a7 commit 92cdde1

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

lib/Oow/Settings/SettingsPage.php

+22-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ class SettingsPage
1818
*/
1919
protected $currentSection;
2020

21+
/**
22+
* @var array of WP_Screen::add_help_tab() arguments
23+
*/
24+
protected $helpTabs = array();
25+
2126
public function __construct(array $options = array())
2227
{
2328
$options['field_values'] = get_option($options['option_name']);
@@ -153,7 +158,7 @@ public function setMenu()
153158

154159
if ($reg['parent_slug'] == 'own') {
155160

156-
add_menu_page(
161+
$hookSuffix = add_menu_page(
157162
$reg['page_title'],
158163
$reg['menu_title'],
159164
$reg['capability'],
@@ -163,7 +168,7 @@ public function setMenu()
163168
$reg['position']
164169
);
165170
} else {
166-
add_submenu_page(
171+
$hookSuffix = add_submenu_page(
167172
$reg['parent_slug'],
168173
$reg['page_title'],
169174
$reg['menu_title'],
@@ -172,5 +177,20 @@ public function setMenu()
172177
array($this, 'render')
173178
);
174179
}
180+
181+
add_action('load-'.$hookSuffix, array($this, 'addHelpTabs'));
182+
}
183+
184+
/**
185+
* Add Help Tabs
186+
*
187+
* @uses WP_Screen::add_help_tab()
188+
*/
189+
public function addHelpTabs()
190+
{
191+
foreach ($this->helpTabs as $tab) {
192+
get_current_screen()->add_help_tab($tab);
193+
}
194+
175195
}
176196
}

0 commit comments

Comments
 (0)