Add screen_options with contextual content, see #18690

git-svn-id: https://develop.svn.wordpress.org/trunk@18864 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2011-10-02 06:59:36 +00:00
parent da55be56a6
commit d0d3855285
20 changed files with 146 additions and 71 deletions
+18 -9
View File
@@ -642,6 +642,7 @@ final class WP_Screen {
// Call old contextual_help_list filter.
if ( ! isset( $_wp_contextual_help ) )
$_wp_contextual_help = array();
$_wp_contextual_help = apply_filters( 'contextual_help_list', $_wp_contextual_help, $this );
if ( isset( $_wp_contextual_help[ $this->id ] ) ) {
@@ -654,14 +655,6 @@ final class WP_Screen {
) );
}
// Add screen options tab
if ( $this->show_screen_options() ) {
$this->add_help_tab( array(
'title' => __('Screen Options'),
'callback' => array( $this, 'render_screen_options' ),
) );
}
// Time to render!
?>
<div id="screen-meta" class='metabox-prefs'>
@@ -712,7 +705,7 @@ final class WP_Screen {
<?php
}
public function show_screen_options() {
public function show_screen_options() { // not needed?
global $wp_meta_boxes, $wp_list_table;
if ( is_bool( $this->_show_screen_options ) )
@@ -746,6 +739,15 @@ final class WP_Screen {
return $this->_show_screen_options;
}
public function add_screen_options($before = '') {
$this->add_help_tab( array(
'title' => __('Screen Options'),
'id' => 'screen-options',
'callback' => array( $this, 'render_screen_options' ),
'content' => $before
));
}
/**
* Render the screen options tab.
*
@@ -756,6 +758,13 @@ final class WP_Screen {
$columns = get_column_headers( $this );
$hidden = get_hidden_columns( $this );
$this->_screen_settings = apply_filters( 'screen_settings', '', $this );
switch ( $this->id ) {
case 'widgets':
$this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
break;
}
?>
<form id="adv-settings" action="" method="post">